Class FunctorUtils
java.lang.Object
org.apache.commons.collections4.functors.FunctorUtils
Internal utilities for functors.
- Since:
- 3.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static <T> T[]clone(T... array) Clones the given array or returns null on null input.coerce(P predicate) A very simple method that coerces Predicateinvalid input: '<'? super T> to Predicate. (package private) static <T extends Consumer<?>>
T[]copy(T... consumers) Clones the consumers to ensure that the internal references can't be updated.(package private) static <T> Predicate<? super T>[]validate(Collection<? extends Predicate<? super T>> predicates) Validate the predicates to ensure that all is well.(package private) static voidValidates the consumers to ensure that all is well.(package private) static voidValidate method(package private) static voidValidate the predicates to ensure that all is well.
-
Constructor Details
-
FunctorUtils
private FunctorUtils()Restricted constructor.
-
-
Method Details
-
clone
private static <T> T[] clone(T... array) Clones the given array or returns null on null input.- Type Parameters:
T- The array type.- Parameters:
array- The array to clone.- Returns:
- The cloned array or null.
-
coerce
A very simple method that coerces Predicateinvalid input: '<'? super T> to Predicate. Due to the method, Predicateinvalid input: '<'? super T> is able to be coerced to Predicateinvalid reference
Predicate#test(T)without casting issues. This method exists simply as centralized documentation and atomic unchecked warning suppression.
- Type Parameters:
T- The type of object the returned predicate should "accept"- Parameters:
predicate- The predicate to coerce.- Returns:
- The coerced predicate.
-
coerce
static <R extends Function<I,O>, R coerceP extends Function<? super I, ? extends O>, I, O> (P transformer) A very simple method that coercesTransformer<? super I, ? extends O>toTransformer<I, O>.This method exists simply as centralized documentation and atomic unchecked warning suppression.
- Type Parameters:
I- The type of object the returned transformer should "accept"O- The type of object the returned transformer should "produce"- Parameters:
transformer- The transformer to coerce.- Returns:
- The coerced transformer.
-
copy
Clones the consumers to ensure that the internal references can't be updated.- Parameters:
consumers- The consumers to copy.- Returns:
- The cloned consumers.
-
copy
Clone the predicates to ensure that the internal reference can't be messed with. Due to themethod, Predicateinvalid input: '<'? super T> is able to be coerced to Predicateinvalid reference
Predicate#test(T)without casting issues. - Parameters:
predicates- The predicates to copy- Returns:
- The cloned predicates
-
copy
Copy method.- Parameters:
transformers- The transformers to copy- Returns:
- A clone of the transformers
-
validate
Validate the predicates to ensure that all is well.- Parameters:
predicates- The predicates to validate- Returns:
- predicate array
-
validate
Validates the consumers to ensure that all is well.- Parameters:
consumers- The consumers to validate.
-
validate
Validate method- Parameters:
functions- The transformers to validate
-
validate
Validate the predicates to ensure that all is well.- Parameters:
predicates- The predicates to validate
-