Skip to content

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