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

Change constructor of a PasswordValidator acording PECS princips. #55

foal opened this Issue Mar 3, 2017 · 3 comments


None yet
2 participants
Copy link

foal commented Mar 3, 2017


public PasswordValidator(final List<Rule> rules)


public PasswordValidator(final List<? super Rule> rules)

see for more information


This comment has been minimized.

Copy link

dfish3r commented May 9, 2017

My reading of that thread lends me to believe that we're got a producer.
And the pattern should be List<? extends Rule>.

Is there a specific compile time problem you're trying to solve?


This comment has been minimized.

Copy link

foal commented May 9, 2017

Easy :)

private static final List<CharacterRule> RULES = ImmutableList.of(ucimpRule);
validator = new PasswordValidator(StreamEx.of(RULES).map(r -> (Rule) r).toList());

This comment has been minimized.

Copy link

foal commented May 9, 2017

And looks like you are right. It is a producer. So List<? extends Rule>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment