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

Replace Predicate and Iterables with Cactoos equivalent #471

Closed
filfreire opened this issue Nov 27, 2017 · 5 comments
Closed

Replace Predicate and Iterables with Cactoos equivalent #471

filfreire opened this issue Nov 27, 2017 · 5 comments

Comments

@filfreire
Copy link
Contributor

filfreire commented Nov 27, 2017

I'm working on yegor256/rultor#1199

How do we replace with the equivalent Cactoos classes the following Guava classes/calls:

RqUser.java (Iterables.any(...) and Predicate):

final boolean granted;
// ...
final Identity identity = this.identity();
granted = Iterables.any(
    readers,
    new Predicate<String>() {
        @Override
        public boolean apply(final String input) {
            return !identity.equals(Identity.ANONYMOUS)
                && input.trim().equals(identity.urn());
        }
    }
);

(edit: removed second question into new issue #476)

@0crat
Copy link
Collaborator

0crat commented Nov 27, 2017

@yegor256 please, pay attention to this issue

@yegor256
Copy link
Owner

yegor256 commented Nov 28, 2017

@filfreire I would kindly ask you to submit one problem per ticket, to avoid confusion and noise. Here, I will answer the first question only. You should use Or:

final boolean granted;
// ...
final Identity identity = this.identity();
granted = new Or(
  r -> !identity.equals(Identity.ANONYMOUS) && r.trim().equals(identity.urn()),
  readers
).value();

yegor256 added a commit that referenced this issue Nov 28, 2017
@filfreire
Copy link
Contributor Author

@yegor256 thanks, Moved second question into a new issue #476. I'm closing this issue, seems to work with your suggestion.

@0crat
Copy link
Collaborator

0crat commented Nov 28, 2017

Oops! There is no order for job gh:yegor256/cactoos#471.

@0crat
Copy link
Collaborator

0crat commented Nov 28, 2017

Oops! Job gh:yegor256/cactoos#471 is not in scope.

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

No branches or pull requests

3 participants