-
Notifications
You must be signed in to change notification settings - Fork 142
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
Add Java 10 Collectors APIs #236
Conversation
For some reason I cannot see the rebase option. Do you mind rebasing your PR? |
give me a sec |
e8246b9
to
f128f6f
Compare
@gkdn done |
@gkdn is there anything I can help you with? |
Sorry was out of office. Still on my radar, will take a look next week. |
} | ||
|
||
private static <T, R> Function<T, R> disallowNulls(Function<T, R> func) { | ||
return func.andThen(Objects::requireNonNull); |
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.
The reuse is not much here; let's implement this explicitly to avoid extra indirect function call for each item
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.
Sorry I wasn't clear enough earlier. I meant something like:
private static <T, R> Function<T, R> disallowNulls(Function<T, R> func) {
return x -> Object.requireNonNull(func.apply(x));
}
(otherwise there would be another lambda indirection in each item during collect)
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.
@treblereel I think you missed this one
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.
@gkdn thank you, let me take a look ...
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.
@gkdn fixed
return true; | ||
} | ||
|
||
public void testToUnmodifiableList() { |
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.
let's move these tests next to other relevant tests.
} | ||
|
||
public void testToUnmodifiableList() { | ||
applyItems(List.of("a", "b"), toUnmodifiableList(), "a", "b", (expected, actual) -> { |
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.
let's not overload "equals" checking with assertion behavior.
We can do something like:
applyItems(List.of("a", "b"), toUnmodifiableList(), "a", "b")
assertUnmodifiableCollection(applyItemsWithSplitting(...))
Fixes #9547 (cherry picked from commit c5d74f1734bd58a7e3e797a6cc8ca89e2cd7134c)
f128f6f
to
cddcb29
Compare
@gkdn compile: writing output: write $WORK/b106/pkg.a: no space left on device |
Commented on the other PR, pls ignore the error (or help us out fixing it 😅) |
I never thought that Google might run out of space |
Well it is the Github hosted service not Google 😂 |
} | ||
} | ||
|
||
private <K, V> void assertUnmodifiableMap(Map<K, V> a, K existingKey, V existingValue, K newKey, |
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.
Let's move this helper next to assertUnmodifiableCollection.
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.
done
(cherry picked from commit c5d74f1734bd58a7e3e797a6cc8ca89e2cd7134c)