Skip to content

switch from ICU ObjectMatcher to Java Predicate #219

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

Merged
merged 2 commits into from
Apr 20, 2022

Conversation

markusicu
Copy link
Member

@markusicu markusicu commented Apr 8, 2022

and then clean up most warnings in UnicodeProperty

For issue #66: This makes unicodetools UnicodeProperty more like CLDR UnicodeProperty. The CLDR version switched to Java Predicate in unicode-org/cldr#460. The warnings cleanup here goes farther than the earlier one in CLDR.

Best to review one commit at a time.

Copy link
Contributor

@echeran echeran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* @return
*/
static <T, U extends Collection<T>> U retainAll(U c, Predicate<T> f) {
for (Iterator<T> it = c.iterator(); it.hasNext();) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi: the Java 8 way of filtering a collection might look like:

return c.stream().filter(f).collect(Collectors.toList());

Just an FYI, since this is probably focused on the higher-level goal of refactoring code across projects.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. My goal was to reduce the yellow warning markers in Eclipse, not to generally modernize the code. There is a ton of code in this project using very old-fashioned Java mechanisms.

@markusicu markusicu merged commit e9c2d08 into unicode-org:main Apr 20, 2022
@markusicu markusicu deleted the refactor-ObjectMatcher branch April 20, 2022 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants