Skip to content

Commit db4fbb3

Browse files
authored
refactoring: Improve monad methods (iluwatar#2300)
1 parent 3751202 commit db4fbb3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

monad/src/main/java/com/iluwatar/monad/Validator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static <T> Validator<T> of(T t) {
7878
* @param message error message when object is invalid
7979
* @return this
8080
*/
81-
public Validator<T> validate(Predicate<T> validation, String message) {
81+
public Validator<T> validate(Predicate<? super T> validation, String message) {
8282
if (!validation.test(obj)) {
8383
exceptions.add(new IllegalStateException(message));
8484
}
@@ -97,8 +97,8 @@ public Validator<T> validate(Predicate<T> validation, String message) {
9797
* @return this
9898
*/
9999
public <U> Validator<T> validate(
100-
Function<T, U> projection,
101-
Predicate<U> validation,
100+
Function<? super T, ? extends U> projection,
101+
Predicate<? super U> validation,
102102
String message
103103
) {
104104
return validate(projection.andThen(validation::test)::apply, message);

0 commit comments

Comments
 (0)