Skip to content

Conversation

@eye-dee
Copy link

@eye-dee eye-dee commented Jul 6, 2017

No description provided.

return new ReachIterable<T>() {
@Override
public boolean tryGet(Consumer<T> consumer) {
return self.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. 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));
Copy link
Contributor

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 -> {
Copy link
Contributor

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.

Copy link
Author

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.

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