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

Drozdov Igor lesson 4 #177

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Drozdov Igor lesson 4 #177

wants to merge 2 commits into from

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