Class Functions
java.lang.Object
org.eclipse.collections.impl.block.factory.Functions
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic final classstatic final classstatic final classstatic final classstatic final classstatic final classstatic final classstatic class
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T,P, R> Function<T, R> Bind the parameter passed to a Function2 into a new Function.static <T1,T2> ObjectIntProcedure<T1> bind(ObjectIntProcedure<? super T2> delegate, Function<? super T1, T2> function) Bind the input of a ObjectIntProcedure to the result of a function, returning a new ObjectIntProcedure.static <T1,T2> Procedure<T1> Bind the input of a Procedure to the result of a function, returning a new Procedure.static <T1,T2, T3> Procedure2<T1, T3> bind(Procedure2<? super T2, T3> delegate, Function<? super T1, T2> function) Bind the input of the first argument of a Procedure2 to the result of a function, returning a new Procedure2.static <T extends Comparable<? super T>,V> 
 CaseFunction<T,V> caseDefault(Function<? super T, ? extends V> defaultFunction) static <T extends Comparable<? super T>,V> 
 CaseFunction<T,V> caseDefault(Function<? super T, ? extends V> defaultFunction, Predicate<? super T> predicate, Function<? super T, ? extends V> function) static <T,V> Function<T, V> Allows a Java 8 lambda and method reference to be used in a method taking a Function as a parameter without any ambiguity.static <T1,T2, T3> Functions.FunctionChain<T1, T2, T3> static <T1,T2> Functions.BooleanFunctionChain<T1, T2> chainBoolean(Function<T1, T2> function1, BooleanFunction<? super T2> function2) static <T1,T2> Functions.ByteFunctionChain<T1, T2> chainByte(Function<T1, T2> function1, ByteFunction<? super T2> function2) static <T1,T2> Functions.CharFunctionChain<T1, T2> chainChar(Function<T1, T2> function1, CharFunction<? super T2> function2) static <T1,T2> Functions.DoubleFunctionChain<T1, T2> chainDouble(Function<T1, T2> function1, DoubleFunction<? super T2> function2) static <T1,T2> Functions.FloatFunctionChain<T1, T2> chainFloat(Function<T1, T2> function1, FloatFunction<? super T2> function2) static <T1,T2> Functions.IntFunctionChain<T1, T2> chainInt(Function<T1, T2> function1, IntFunction<? super T2> function2) static <T1,T2> Functions.LongFunctionChain<T1, T2> chainLong(Function<T1, T2> function1, LongFunction<? super T2> function2) static <T1,T2> Functions.ShortFunctionChain<T1, T2> chainShort(Function<T1, T2> function1, ShortFunction<? super T2> function2) firstNotEmptyCollectionValue(Function<T1, I>... functions) firstNotEmptyStringValue(Function<T, String>... functions) static <T,V> Function<T, V> firstNotNullValue(Function<T, V>... functions) getFalse()static <T,V> Function<T, V> getFixedValue(V value) getNullSafeToString(String defaultValue) static <T> Function<T,T> Alias for identity().getTrue()static <T> Function<T,T> identity()static <T,V> Function<T, V> ifElse(Predicate<? super T> predicate, Function<? super T, ? extends V> trueFunction, Function<? super T, ? extends V> falseFunction) static <T,V> Function<T, V> static <T,V> Function<T, V> static <T,V> Function<T, V> Swap the input pair and return the swapped pair.static <T,V> Function<T, V> synchronizedEach(Function<T, V> function) static <T,V> Function<T, V> throwing(ThrowingFunction<T, V> throwingFunction) Allows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Function that will throw a RuntimeException, wrapping the checked exception that is the cause.static <T,V> Function<T, V> throwing(ThrowingFunction<T, V> throwingFunction, Function2<T, ? super Throwable, ? extends RuntimeException> rethrow) Allows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Function that will throw a user specified RuntimeException based on the provided function.static <T> SerializableComparator<T>toBooleanComparator(BooleanFunction<T> function) static <T> SerializableComparator<T>toByteComparator(ByteFunction<T> function) static <T> SerializableComparator<T>toCharComparator(CharFunction<T> function) static <T> SerializableComparator<T>toDoubleComparator(DoubleFunction<T> function) static <T> SerializableComparator<T>toFloatComparator(FloatFunction<T> function) static <T> SerializableComparator<T>toIntComparator(IntFunction<T> function) static <T> SerializableComparator<T>toLongComparator(LongFunction<T> function) static <T> SerializableComparator<T>toShortComparator(ShortFunction<T> function) static <T,V> Function<T, V> withDefault(Function<? super T, ? extends V> function, V defaultValue) 
- 
Method Details- 
throwingAllows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Function that will throw a RuntimeException, wrapping the checked exception that is the cause.
- 
throwingpublic static <T,V> Function<T,V> throwing(ThrowingFunction<T, V> throwingFunction, Function2<T, ? super Throwable, ? extends RuntimeException> rethrow) Allows a lambda or anonymous inner class that needs to throw a checked exception to be safely wrapped as a Function that will throw a user specified RuntimeException based on the provided function. The function is passed the current element and the checked exception that was thrown as context arguments.
- 
castAllows a Java 8 lambda and method reference to be used in a method taking a Function as a parameter without any ambiguity.
- 
getPassThruAlias for identity(). Inlineable.- See Also:
 
- 
identity- Since:
- 6.0
 
- 
getTrue- Since:
- 6.0
 
- 
getFalse- Since:
- 6.0
 
- 
getFixedValue
- 
getToClass
- 
getMathSinFunction
- 
getNumberPassThru
- 
getIntegerPassThru
- 
getLongPassThru
- 
getDoublePassThru
- 
getStringPassThru
- 
getStringTrim
- 
getToString
- 
getNullSafeToString
- 
toBooleanComparator
- 
toByteComparator
- 
toCharComparator
- 
toFloatComparator
- 
toShortComparator
- 
toIntComparator
- 
toDoubleComparator
- 
toLongComparator
- 
getStringToInteger
- 
withDefault
- 
nullSafe
- 
nullSafe
- 
firstOfPair
- 
secondOfPair
- 
swappedPairSwap the input pair and return the swapped pair.- Returns:
- A function that gets the swapped pair Iterable
 
- 
bindpublic static <T,P, Function<T,R> R> bind(Function2<? super T, ? super P, ? extends R> function, P parameter) Bind the parameter passed to a Function2 into a new Function.- Parameters:
- function- The Function2 to delegate the invocation to.
- parameter- The parameter the use in the invocation of the delegate function.
- Returns:
- A new Function
 
- 
bindpublic static <T1,T2> Procedure<T1> bind(Procedure<? super T2> delegate, Function<? super T1, T2> function) Bind the input of a Procedure to the result of a function, returning a new Procedure.- Parameters:
- delegate- The Procedure to delegate the invocation to.
- function- The Function that will create the input for the delegate
- Returns:
- A new Procedure
 
- 
bindpublic static <T1,T2> ObjectIntProcedure<T1> bind(ObjectIntProcedure<? super T2> delegate, Function<? super T1, T2> function) Bind the input of a ObjectIntProcedure to the result of a function, returning a new ObjectIntProcedure.- Parameters:
- delegate- The ObjectIntProcedure to delegate the invocation to.
- function- The Function that will create the input for the delegate
- Returns:
- A new ObjectIntProcedure
 
- 
bindpublic static <T1,T2, Procedure2<T1,T3> T3> bind(Procedure2<? super T2, T3> delegate, Function<? super T1, T2> function) Bind the input of the first argument of a Procedure2 to the result of a function, returning a new Procedure2.- Parameters:
- delegate- The Procedure2 to delegate the invocation to.
- function- The Function that will create the input for the delegate
- Returns:
- A new Procedure2
 
- 
squaredInteger
- 
firstNotNullValue
- 
firstNotEmptyStringValue
- 
firstNotEmptyCollectionValue
- 
ifTrue
- 
ifElse
- 
caseDefaultpublic static <T extends Comparable<? super T>,V> CaseFunction<T,V> caseDefault(Function<? super T, ? extends V> defaultFunction) 
- 
caseDefaultpublic static <T extends Comparable<? super T>,V> CaseFunction<T,V> caseDefault(Function<? super T, ? extends V> defaultFunction, Predicate<? super T> predicate, Function<? super T, ? extends V> function) 
- 
synchronizedEach
- 
classForName
- 
chainpublic static <T1,T2, Functions.FunctionChain<T1,T3> T2, chainT3> (Function<T1, T2> function1, Function<? super T2, T3> function2) 
- 
chainBooleanpublic static <T1,T2> Functions.BooleanFunctionChain<T1,T2> chainBoolean(Function<T1, T2> function1, BooleanFunction<? super T2> function2) 
- 
chainBytepublic static <T1,T2> Functions.ByteFunctionChain<T1,T2> chainByte(Function<T1, T2> function1, ByteFunction<? super T2> function2) 
- 
chainCharpublic static <T1,T2> Functions.CharFunctionChain<T1,T2> chainChar(Function<T1, T2> function1, CharFunction<? super T2> function2) 
- 
chainDoublepublic static <T1,T2> Functions.DoubleFunctionChain<T1,T2> chainDouble(Function<T1, T2> function1, DoubleFunction<? super T2> function2) 
- 
chainFloatpublic static <T1,T2> Functions.FloatFunctionChain<T1,T2> chainFloat(Function<T1, T2> function1, FloatFunction<? super T2> function2) 
- 
chainIntpublic static <T1,T2> Functions.IntFunctionChain<T1,T2> chainInt(Function<T1, T2> function1, IntFunction<? super T2> function2) 
- 
chainLongpublic static <T1,T2> Functions.LongFunctionChain<T1,T2> chainLong(Function<T1, T2> function1, LongFunction<? super T2> function2) 
- 
chainShortpublic static <T1,T2> Functions.ShortFunctionChain<T1,T2> chainShort(Function<T1, T2> function1, ShortFunction<? super T2> function2) 
- 
pair
- 
getKeyFunction- Returns:
- A function that gets the key out of a Map.Entry
 
- 
getValueFunction- Returns:
- A function that gets the value out of a Map.Entry
 
- 
getSizeOf- Returns:
- A function that gets the size of an Iterable
 
 
-