Skip to content

Commit

Permalink
Added another utility
Browse files Browse the repository at this point in the history
  • Loading branch information
mihxil committed Jan 10, 2024
1 parent 21d4bbc commit f2cb91d
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ public static <T> Predicate<T> always(boolean value, String toString) {
return new Always<>(value, toString);
}


/**
* Returns a {@link Predicate} that always results in the same {@code boolean} value
* @param value The boolean value to always return*
* @param <T> The type of the (ignored) argument of the predicate
* @see #alwaysFalse()
* @see #alwaysTrue()
* @return A new Predicate, with described properties. It {@code equals} all such predicates wrapping the same {@code value}
*/
public static <T> Predicate<T> always(boolean value) {
return value ? alwaysTrue() : alwaysFalse();
}


/**
* Returns a {@link Predicate} that always results {@code false}, regardless of the argument. The toString value
* is {@link #FALSE}
Expand Down

0 comments on commit f2cb91d

Please sign in to comment.