-
Notifications
You must be signed in to change notification settings - Fork 66
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
Drozdov Igor lesson 4 #177
base: master
Are you sure you want to change the base?
Conversation
return new ReachIterable<T>() { | ||
@Override | ||
public boolean tryGet(Consumer<T> consumer) { | ||
return self.tryGet(t -> { |
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.
Incorrect. You should either return false
or return true
and call consumer
.
@Override | ||
public boolean tryGet(final Consumer<R> consumer) { | ||
boolean res = self.tryGet(t -> reachIterable = function.apply(t)); | ||
while (reachIterable.tryGet(consumer)); |
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.
Incorrect. You should call consumer
only once.
|
||
default Optional<T> firstMatch(Predicate<T> predicate) { | ||
final Object[] objects = new Object[1]; | ||
while (tryGet(t -> { |
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.
Incorrect. firstMatch
should be able to return value in case of infinite stream.
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.
It will return value, when test return true.
No description provided.