Skip to content
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

Part 4 (by Narek Karapetian) #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

NarekDW
Copy link

@NarekDW NarekDW commented Jul 6, 2017

No description provided.

}

default ReachIterable<T> filter(Predicate<T> p) {
return c -> tryGet(t -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect. tryGet should either call consumer or return false

}

default <R> ReachIterable<R> flatMap(Function<T, ReachIterable<R>> f) {
return c -> tryGet(t -> f.apply(t).toList().forEach(r -> c.accept(r)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect. tryGet can call consumer only once.

final Object[] res = new Object[1];
final boolean[] b = {true};
while (b[0]) {
b[0] = tryGet(t -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Incorrect. Try it on infinite collection with firstMatch(a -> true)

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.

2 participants