New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove ListUtil and Fields classes #1926
Remove ListUtil and Fields classes #1926
Conversation
andreisilviudragnea
commented
May 7, 2020
- Removed ListUtil class in favor of Java 8 Streams
- Removed unused Fields class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I'm not a committer)
LGTM
|
||
if (verifiedOnly.isEmpty()) { | ||
return null; | ||
} else { | ||
return verifiedOnly.getLast(); | ||
return verifiedOnly.get(verifiedOnly.size() - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be .reduce((first, second) -> second).orElse(null)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isnt the existing:
- more readable
- performant, getLast is O(1) for array and linked list
Sorry for the silly question.
I have to check whether this breaks Android projects 😢 |
Yes, I would expect someone to use it outside of Mockito. Maybe just not using it internally anymore. |
Sadly we can't adopt this PR for now, given that it breaks our Android users. However much I would love to merge, it sadly breaks too many users for now. Hopefully we can revisit this in the future once the Android ecosystem has caught up with Java. Apologies for the late response. |
@TimvdLippe What about still deprecating them and leaving them around? What did you mean by |
We merged this after all in #2593, as it didn't break our Android api compatibility (SDK 24+). Thanks @andreisilviudragnea for getting back to us! |