Package org.n52.janmayen.function
Class Predicates
java.lang.Object
org.n52.janmayen.function.Predicates
Utility functions for
Predicate.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Predicate<T> Creates a predicate that is alwaysfalse.static <T> Predicate<T> Creates a predicate that is alwaystrue.static <T> Predicate<T> constant(boolean value) Creates a predicate that returns a constant value.static <T,U> Predicate <U> curryFirst(BiPredicate<T, U> predicate, T t) Curries the first parameter of theBiPredicateand creates aPredicate.static <T,U> Predicate <T> currySecond(BiPredicate<T, U> predicate, U u) Curries the second parameter of theBiPredicateand creates aPredicate.static <T,U extends T>
Predicate<T> instanceOf(Class<? extends U> clazz) Creates aPredicatethat checks if it's input is an instance ofclazz.static <T> Predicate<T> Negates the predicate.static <T> Predicate<T> Creates a predicate.
-
Method Details
-
not
Negates the predicate.- Type Parameters:
T- the type of the input to the predicate- Parameters:
predicate- the predicate to negate- Returns:
- the negated predicate
-
of
Creates a predicate.- Type Parameters:
T- the type of the input to the predicate- Parameters:
predicate- the predicate- Returns:
- the predicate
-
alwaysFalse
Creates a predicate that is alwaysfalse.- Type Parameters:
T- the type of the input to the predicate- Returns:
- the predicate
-
alwaysTrue
Creates a predicate that is alwaystrue.- Type Parameters:
T- the type of the input to the predicate- Returns:
- the predicate
-
constant
Creates a predicate that returns a constant value.- Type Parameters:
T- the type of the input to the predicate- Parameters:
value- the constant value- Returns:
- the predicate
-
instanceOf
Creates aPredicatethat checks if it's input is an instance ofclazz.- Type Parameters:
T- The input type.U- The type of which the input has to be an instance of.- Parameters:
clazz- The class of which the input has to be an instance of.- Returns:
- The predicate.
-
curryFirst
Curries the first parameter of theBiPredicateand creates aPredicate.- Type Parameters:
T- the first parameter typeU- the second parameter type- Parameters:
predicate- the predicatet- the curried parameter- Returns:
- the curried predicate
-
currySecond
Curries the second parameter of theBiPredicateand creates aPredicate.- Type Parameters:
T- the first parameter typeU- the second parameter type- Parameters:
predicate- the predicateu- the curried parameter- Returns:
- the curried predicate
-