Package io.smallrye.common.function
Class Functions
- java.lang.Object
-
- io.smallrye.common.function.Functions
-
public final class Functions extends Object
A set of utility methods which return common functions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,U>
RunnablecapturingRunnable(BiConsumer<T,U> consumer, T param1, U param2)Get a runnable which executes the given consumer with captured values.static <T> RunnablecapturingRunnable(Consumer<T> consumer, T param)Get a runnable which executes the given consumer with captured values.static <T,E extends EE,TT extends T,U,UU extends U,EE extends Exception>
ExceptionBiConsumer<TT,UU,EE>cast(ExceptionBiConsumer<T,U,E> consumer)Returns aExceptionBiConsumerwith identical behavior to the specifiedExceptionBiConsumerbut with restricted parameter types and relaxed exception type.static <T,U,R extends RR,E extends EE,TT extends T,UU extends U,RR,EE extends Exception>
ExceptionBiFunction<TT,UU,RR,EE>cast(ExceptionBiFunction<T,U,R,E> function)Returns aExceptionBiFunctionwith identical behavior to the specifiedExceptionBiFunctionbut with restricted parameter types, relaxed return type, and relaxed exception type.static <T,U,E extends EE,TT extends T,UU extends U,EE extends Exception>
ExceptionBiPredicate<TT,UU,EE>cast(ExceptionBiPredicate<T,U,E> predicate)Returns aExceptionBiPredicatewith identical behavior to the specifiedExceptionBiPredicatebut with restricted parameter types and relaxed exception type.static <T,E extends EE,TT extends T,EE extends Exception>
ExceptionConsumer<TT,EE>cast(ExceptionConsumer<T,E> consumer)Returns aExceptionConsumerwith identical behavior to the specifiedExceptionConsumerbut with restricted parameter type and relaxed exception type.static <T,R extends RR,E extends EE,TT extends T,RR,EE extends Exception>
ExceptionFunction<TT,RR,EE>cast(ExceptionFunction<T,R,E> function)Returns aExceptionFunctionwith identical behavior to the specifiedExceptionFunctionbut with restricted parameter type, relaxed return type, and relaxed exception type.static <R extends RR,E extends EE,RR,EE extends Exception>
ExceptionIntFunction<RR,EE>cast(ExceptionIntFunction<R,E> function)Returns aExceptionIntFunctionwith identical behavior to the specifiedExceptionFunctionbut with relaxed return type and relaxed exception type.static <R extends RR,E extends EE,RR,EE extends Exception>
ExceptionLongFunction<RR,EE>cast(ExceptionLongFunction<R,E> function)Returns aExceptionLongFunctionwith identical behavior to the specifiedExceptionLongFunctionbut with relaxed return type and relaxed exception type.static <T,E extends EE,TT extends T,EE extends Exception>
ExceptionObjIntConsumer<TT,EE>cast(ExceptionObjIntConsumer<T,E> consumer)Returns aExceptionObjIntConsumerwith identical behavior to the specifiedExceptionObjIntConsumerbut with restricted parameter type and relaxed exception type.static <T,E extends EE,TT extends T,EE extends Exception>
ExceptionObjLongConsumer<TT,EE>cast(ExceptionObjLongConsumer<T,E> consumer)Returns aExceptionObjLongConsumerwith identical behavior to the specifiedExceptionObjLongConsumerbut with restricted parameter type and relaxed exception type.static <T,E extends EE,TT extends T,EE extends Exception>
ExceptionPredicate<TT,EE>cast(ExceptionPredicate<T,E> consumer)Returns aExceptionPredicatewith identical behavior to the specifiedExceptionPredicatebut with restricted parameter type and relaxed exception type.static <T extends TT,E extends EE,TT,EE extends Exception>
ExceptionSupplier<TT,EE>cast(ExceptionSupplier<T,E> supplier)Returns aExceptionSupplierwith identical behavior to the specifiedExceptionSupplierbut with relaxed return type and relaxed exception type.static <T,U,E extends EE,TT extends T,UU extends U,EE extends Exception>
ExceptionToIntBiFunction<TT,UU,EE>cast(ExceptionToIntBiFunction<T,U,E> function)Returns aExceptionToIntBiFunctionwith identical behavior to the specifiedExceptionToIntBiFunctionbut with restricted parameter types and relaxed exception type.static <T,E extends EE,TT extends T,EE extends Exception>
ExceptionToIntFunction<TT,EE>cast(ExceptionToIntFunction<T,E> function)Returns aExceptionToIntFunctionwith identical behavior to the specifiedExceptionToIntFunctionbut with restricted parameter type and relaxed exception type.static <T,U,E extends EE,TT extends T,UU extends U,EE extends Exception>
ExceptionToLongBiFunction<TT,UU,EE>cast(ExceptionToLongBiFunction<T,U,E> function)Returns aExceptionToLongBiFunctionwith identical behavior to the specifiedExceptionToLongBiFunctionbut with restricted parameter types and relaxed exception type.static <T,E extends EE,TT extends T,EE extends Exception>
ExceptionToLongFunction<TT,EE>cast(ExceptionToLongFunction<T,E> function)Returns aExceptionToLongFunctionwith identical behavior to the specifiedExceptionToLongFunctionbut with restricted parameter type and relaxed exception type.static <T,U,TT extends T,UU extends U>
BiConsumer<TT,UU>cast(BiConsumer<T,U> consumer)Returns aBiConsumerwith identical behavior to the specifiedBiConsumerbut with restricted parameter types.static <T,U,R extends RR,TT extends T,UU extends U,RR>
BiFunction<TT,UU,RR>cast(BiFunction<T,U,R> function)Returns aBiFunctionwith identical behavior to the specifiedBiFunctionbut with restricted parameter types and relaxed return type.static <T,U,TT extends T,UU extends U>
BiPredicate<TT,UU>cast(BiPredicate<T,U> predicate)Returns aBiPredicatewith identical behavior to the specifiedBiPredicatebut with restricted parameter types.static <T,TT extends T>
Consumer<TT>cast(Consumer<T> consumer)static <R extends RR,RR>
DoubleFunction<RR>cast(DoubleFunction<R> function)Returns aDoubleFunctionwith identical behavior to the specifiedDoubleFunctionbut with relaxed return type.static <T,R extends RR,TT extends T,RR>
Function<TT,RR>cast(Function<T,R> function)static <R extends RR,RR>
IntFunction<RR>cast(IntFunction<R> function)Returns aIntFunctionwith identical behavior to the specifiedIntFunctionbut with relaxed return type.static <R extends RR,RR>
LongFunction<RR>cast(LongFunction<R> function)Returns aLongFunctionwith identical behavior to the specifiedLongFunctionbut with relaxed return type.static <T,TT extends T>
ObjDoubleConsumer<TT>cast(ObjDoubleConsumer<T> consumer)Returns aObjDoubleConsumerwith identical behavior to the specifiedObjDoubleConsumerbut with restricted parameter type.static <T,TT extends T>
ObjIntConsumer<TT>cast(ObjIntConsumer<T> consumer)Returns aObjIntConsumerwith identical behavior to the specifiedObjIntConsumerbut with restricted parameter type.static <T,TT extends T>
ObjLongConsumer<TT>cast(ObjLongConsumer<T> consumer)Returns aObjLongConsumerwith identical behavior to the specifiedObjLongConsumerbut with restricted parameter type.static <T,TT extends T>
Predicate<TT>cast(Predicate<T> predicate)static <T extends TT,TT>
Supplier<TT>cast(Supplier<T> supplier)static <T,U,TT extends T,UU extends U>
ToDoubleBiFunction<TT,UU>cast(ToDoubleBiFunction<T,U> function)Returns aToDoubleBiFunctionwith identical behavior to the specifiedToDoubleBiFunctionbut with restricted parameter types.static <T,TT extends T>
ToDoubleFunction<TT>cast(ToDoubleFunction<T> function)Returns aToDoubleFunctionwith identical behavior to the specifiedToDoubleFunctionbut with restricted parameter type.static <T,U,TT extends T,UU extends U>
ToIntBiFunction<TT,UU>cast(ToIntBiFunction<T,U> function)Returns aToIntBiFunctionwith identical behavior to the specifiedToIntBiFunctionbut with restricted parameter types.static <T,TT extends T>
ToIntFunction<TT>cast(ToIntFunction<T> function)Returns aToIntFunctionwith identical behavior to the specifiedToIntFunctionbut with restricted parameter type.static <T,U,TT extends T,UU extends U>
ToLongBiFunction<TT,UU>cast(ToLongBiFunction<T,U> function)Returns aToLongBiFunctionwith identical behavior to the specifiedToLongBiFunctionbut with restricted parameter types.static <T,TT extends T>
ToLongFunction<TT>cast(ToLongFunction<T> function)Returns aToLongFunctionwith identical behavior to the specifiedToLongFunctionbut with restricted parameter type.static <T extends AutoCloseable>
Consumer<T>closingConsumer()Returns a consumer that quietly closes its argument, logging any exceptions.static <T,E extends Exception>
ExceptionSupplier<T,E>constantExceptionSupplier(T value)Get a supplier which always returns the same value.static <T> Supplier<T>constantSupplier(T value)Get a supplier which always returns the same value.static <T> BiConsumer<Consumer<T>,T>consumerBiConsumer()Get the singleton consumer which accepts a consumer and an argument to hand to it.static <T> ExceptionBiConsumer<Consumer<T>,T,RuntimeException>consumerExceptionBiConsumer()Get the singleton consumer which accepts a consumer and an argument to hand to it.static <T,U>
BiConsumer<T,U>discardingBiConsumer()Get a consumer which discards the values it is given.static <T> Consumer<T>discardingConsumer()Get a consumer which discards the values it is given.static <T,U,E extends Exception>
ExceptionBiConsumer<T,U,E>discardingExceptionBiConsumer()Get a consumer which discards the values it is given.static <T,E extends Exception>
ExceptionConsumer<T,E>discardingExceptionConsumer()Get a consumer which discards the values it is given.static <T,U,E extends Exception>
ExceptionRunnable<E>exceptionCapturingRunnable(ExceptionBiConsumer<T,U,E> consumer, T param1, U param2)Get a runnable which executes the given consumer with captured values.static <T,E extends Exception>
ExceptionRunnable<E>exceptionCapturingRunnable(ExceptionConsumer<T,E> consumer, T param)Get a runnable which executes the given consumer with captured values.static <T,E extends Exception>
ExceptionBiConsumer<ExceptionConsumer<T,E>,T,E>exceptionConsumerBiConsumer()Get the singleton consumer which accepts a consumer and an argument to hand to it.static <T,R,E extends Exception>
ExceptionBiFunction<ExceptionFunction<T,R,E>,T,R,E>exceptionFunctionBiFunction()Get the singleton function which accepts a function and a parameter to pass to the function, and returns the result of the function.static <E extends Exception>
Consumer<E>exceptionLoggingConsumer()Returns a consumer that logs its exception parameter as a warning.static <E extends Exception>
ExceptionConsumer<ExceptionRunnable<E>,E>exceptionRunnableConsumer()Get the singleton exception consumer which accepts and runs exception runnable instances.static <R,E extends Exception>
ExceptionFunction<ExceptionSupplier<R,E>,R,E>exceptionSupplierFunction()Get the singleton function which accepts a supplier and returns the result of the supplier.static <R,E extends Exception>
ExceptionBiFunction<ExceptionFunction<ExceptionSupplier<R,E>,R,E>,ExceptionSupplier<R,E>,R,E>exceptionSupplierFunctionBiFunction()Get the singleton function which accepts a function which accepts a supplier, all of which return the result of the supplier.static <T,R>
BiFunction<Function<T,R>,T,R>functionBiFunction()Get the singleton function which accepts a function and a parameter to pass to the function, and returns the result of the function.static <T,R>
ExceptionBiFunction<Function<T,R>,T,R,RuntimeException>functionExceptionBiFunction()Get the singleton function which accepts a function and a parameter to pass to the function, and returns the result of the function.static <T,U,E extends Exception>
BiConsumer<T,U>quiet(ExceptionBiConsumer<T,U,E> consumer, Consumer<E> handler)Converts anExceptionBiConsumerto a standardBiConsumerusing the specified exception handler.static <T,E extends Exception>
Consumer<T>quiet(ExceptionConsumer<T,E> consumer, Consumer<E> handler)Converts anExceptionConsumerto a standardConsumerusing the specified exception handler.static <T,E extends Exception>
ObjIntConsumer<T>quiet(ExceptionObjIntConsumer<T,E> consumer, Consumer<E> handler)Converts anExceptionObjIntConsumerto a standardObjIntConsumerusing the specified exception handler.static <T,E extends Exception>
ObjLongConsumer<T>quiet(ExceptionObjLongConsumer<T,E> consumer, Consumer<E> handler)Converts anExceptionObjLongConsumerto a standardObjLongConsumerusing the specified exception handler.static Consumer<Runnable>runnableConsumer()Get the singleton consumer which accepts and runs runnable instances.static ExceptionConsumer<Runnable,RuntimeException>runnableExceptionConsumer()Get the singleton exception consumer which accepts and runs runnable instances.static <E extends Exception,RE extends RuntimeException>
Consumer<E>runtimeExceptionThrowingConsumer(Function<E,RE> wrapper)Returns a consumer that wraps and throws its exception parameter as aRuntimeException.static <R> ExceptionFunction<Supplier<R>,R,RuntimeException>supplierExceptionFunction()Get the singleton function which accepts a supplier and returns the result of the supplier.static <R> Function<Supplier<R>,R>supplierFunction()Get the singleton function which accepts a supplier and returns the result of the supplier.static <R> BiFunction<Function<Supplier<R>,R>,Supplier<R>,R>supplierFunctionBiFunction()Get the singleton function which accepts a function which accepts a supplier, all of which return the result of the supplier.
-
-
-
Method Detail
-
runnableConsumer
public static Consumer<Runnable> runnableConsumer()
Get the singleton consumer which accepts and runs runnable instances.- Returns:
- the runnable consumer
-
exceptionRunnableConsumer
public static <E extends Exception> ExceptionConsumer<ExceptionRunnable<E>,E> exceptionRunnableConsumer()
Get the singleton exception consumer which accepts and runs exception runnable instances.- Type Parameters:
E- the exception type- Returns:
- the runnable consumer
-
runnableExceptionConsumer
public static ExceptionConsumer<Runnable,RuntimeException> runnableExceptionConsumer()
Get the singleton exception consumer which accepts and runs runnable instances.- Returns:
- the runnable consumer
-
consumerBiConsumer
public static <T> BiConsumer<Consumer<T>,T> consumerBiConsumer()
Get the singleton consumer which accepts a consumer and an argument to hand to it.- Type Parameters:
T- the argument type- Returns:
- the consumer
-
exceptionConsumerBiConsumer
public static <T,E extends Exception> ExceptionBiConsumer<ExceptionConsumer<T,E>,T,E> exceptionConsumerBiConsumer()
Get the singleton consumer which accepts a consumer and an argument to hand to it.- Type Parameters:
T- the argument typeE- the exception type- Returns:
- the consumer
-
consumerExceptionBiConsumer
public static <T> ExceptionBiConsumer<Consumer<T>,T,RuntimeException> consumerExceptionBiConsumer()
Get the singleton consumer which accepts a consumer and an argument to hand to it.- Type Parameters:
T- the argument type- Returns:
- the consumer
-
supplierFunction
public static <R> Function<Supplier<R>,R> supplierFunction()
Get the singleton function which accepts a supplier and returns the result of the supplier.- Type Parameters:
R- the result type- Returns:
- the function
-
exceptionSupplierFunction
public static <R,E extends Exception> ExceptionFunction<ExceptionSupplier<R,E>,R,E> exceptionSupplierFunction()
Get the singleton function which accepts a supplier and returns the result of the supplier.- Type Parameters:
R- the result typeE- the exception type- Returns:
- the function
-
supplierExceptionFunction
public static <R> ExceptionFunction<Supplier<R>,R,RuntimeException> supplierExceptionFunction()
Get the singleton function which accepts a supplier and returns the result of the supplier.- Type Parameters:
R- the result type- Returns:
- the function
-
supplierFunctionBiFunction
public static <R> BiFunction<Function<Supplier<R>,R>,Supplier<R>,R> supplierFunctionBiFunction()
Get the singleton function which accepts a function which accepts a supplier, all of which return the result of the supplier.- Type Parameters:
R- the result type- Returns:
- the function
-
exceptionSupplierFunctionBiFunction
public static <R,E extends Exception> ExceptionBiFunction<ExceptionFunction<ExceptionSupplier<R,E>,R,E>,ExceptionSupplier<R,E>,R,E> exceptionSupplierFunctionBiFunction()
Get the singleton function which accepts a function which accepts a supplier, all of which return the result of the supplier.- Type Parameters:
R- the result typeE- the exception type- Returns:
- the function
-
functionBiFunction
public static <T,R> BiFunction<Function<T,R>,T,R> functionBiFunction()
Get the singleton function which accepts a function and a parameter to pass to the function, and returns the result of the function.- Type Parameters:
T- the argument typeR- the result type- Returns:
- the function
-
exceptionFunctionBiFunction
public static <T,R,E extends Exception> ExceptionBiFunction<ExceptionFunction<T,R,E>,T,R,E> exceptionFunctionBiFunction()
Get the singleton function which accepts a function and a parameter to pass to the function, and returns the result of the function.- Type Parameters:
T- the argument typeR- the result typeE- the exception type- Returns:
- the function
-
functionExceptionBiFunction
public static <T,R> ExceptionBiFunction<Function<T,R>,T,R,RuntimeException> functionExceptionBiFunction()
Get the singleton function which accepts a function and a parameter to pass to the function, and returns the result of the function.- Type Parameters:
T- the argument typeR- the result type- Returns:
- the function
-
constantSupplier
public static <T> Supplier<T> constantSupplier(T value)
Get a supplier which always returns the same value.- Type Parameters:
T- the value type- Parameters:
value- the value to return- Returns:
- the value supplier
-
constantExceptionSupplier
public static <T,E extends Exception> ExceptionSupplier<T,E> constantExceptionSupplier(T value)
Get a supplier which always returns the same value.- Type Parameters:
T- the value typeE- the exception type- Parameters:
value- the value to return- Returns:
- the value supplier
-
capturingRunnable
public static <T,U> Runnable capturingRunnable(BiConsumer<T,U> consumer, T param1, U param2)
Get a runnable which executes the given consumer with captured values.- Type Parameters:
T- the first parameter typeU- the second parameter type- Parameters:
consumer- the consumer to run (must not benull)param1- the first parameter to passparam2- the second parameter to pass- Returns:
- the capturing runnable
-
capturingRunnable
public static <T> Runnable capturingRunnable(Consumer<T> consumer, T param)
Get a runnable which executes the given consumer with captured values.- Type Parameters:
T- the parameter type- Parameters:
consumer- the consumer to run (must not benull)param- the parameter to pass- Returns:
- the capturing runnable
-
exceptionCapturingRunnable
public static <T,U,E extends Exception> ExceptionRunnable<E> exceptionCapturingRunnable(ExceptionBiConsumer<T,U,E> consumer, T param1, U param2)
Get a runnable which executes the given consumer with captured values.- Type Parameters:
T- the first parameter typeU- the second parameter typeE- the exception type- Parameters:
consumer- the consumer to run (must not benull)param1- the first parameter to passparam2- the second parameter to pass- Returns:
- the capturing runnable
-
exceptionCapturingRunnable
public static <T,E extends Exception> ExceptionRunnable<E> exceptionCapturingRunnable(ExceptionConsumer<T,E> consumer, T param)
Get a runnable which executes the given consumer with captured values.- Type Parameters:
T- the parameter typeE- the exception type- Parameters:
consumer- the consumer to run (must not benull)param- the parameter to pass- Returns:
- the capturing runnable
-
discardingConsumer
public static <T> Consumer<T> discardingConsumer()
Get a consumer which discards the values it is given.- Type Parameters:
T- the parameter type- Returns:
- the discarding consumer
-
discardingExceptionConsumer
public static <T,E extends Exception> ExceptionConsumer<T,E> discardingExceptionConsumer()
Get a consumer which discards the values it is given.- Type Parameters:
T- the parameter typeE- the exception type- Returns:
- the discarding consumer
-
discardingBiConsumer
public static <T,U> BiConsumer<T,U> discardingBiConsumer()
Get a consumer which discards the values it is given.- Type Parameters:
T- the first parameter typeU- the second parameter type- Returns:
- the discarding consumer
-
discardingExceptionBiConsumer
public static <T,U,E extends Exception> ExceptionBiConsumer<T,U,E> discardingExceptionBiConsumer()
Get a consumer which discards the values it is given.- Type Parameters:
T- the first parameter typeU- the second parameter typeE- the exception type- Returns:
- the discarding consumer
-
closingConsumer
public static <T extends AutoCloseable> Consumer<T> closingConsumer()
Returns a consumer that quietly closes its argument, logging any exceptions.- Returns:
- a closing consumer
-
exceptionLoggingConsumer
public static <E extends Exception> Consumer<E> exceptionLoggingConsumer()
Returns a consumer that logs its exception parameter as a warning.- Type Parameters:
E- the exception type- Returns:
- an exception consumer
-
runtimeExceptionThrowingConsumer
public static <E extends Exception,RE extends RuntimeException> Consumer<E> runtimeExceptionThrowingConsumer(Function<E,RE> wrapper)
Returns a consumer that wraps and throws its exception parameter as aRuntimeException.- Type Parameters:
E- the exception type- Parameters:
wrapper- a runtime exception wrapper- Returns:
- an exception consumer
-
quiet
public static <T,E extends Exception> Consumer<T> quiet(ExceptionConsumer<T,E> consumer, Consumer<E> handler)
Converts anExceptionConsumerto a standardConsumerusing the specified exception handler.- Type Parameters:
T- the parameter type of the consumerE- the exception type- Parameters:
consumer- an exception consumerhandler- an exception handler- Returns:
- a standard consumer
-
quiet
public static <T,U,E extends Exception> BiConsumer<T,U> quiet(ExceptionBiConsumer<T,U,E> consumer, Consumer<E> handler)
Converts anExceptionBiConsumerto a standardBiConsumerusing the specified exception handler.- Type Parameters:
T- the first parameter type of the consumerU- the second parameter type of the consumerE- the exception type- Parameters:
consumer- a binary exception consumerhandler- an exception handler- Returns:
- a standard binary consumer
-
quiet
public static <T,E extends Exception> ObjIntConsumer<T> quiet(ExceptionObjIntConsumer<T,E> consumer, Consumer<E> handler)
Converts anExceptionObjIntConsumerto a standardObjIntConsumerusing the specified exception handler.- Type Parameters:
T- the first parameter type of the consumerE- the exception type- Parameters:
consumer- an object/int exception consumerhandler- an exception handler- Returns:
- a standard object/int consumer
-
quiet
public static <T,E extends Exception> ObjLongConsumer<T> quiet(ExceptionObjLongConsumer<T,E> consumer, Consumer<E> handler)
Converts anExceptionObjLongConsumerto a standardObjLongConsumerusing the specified exception handler.- Type Parameters:
T- the first parameter type of the consumerE- the exception type- Parameters:
consumer- an object/long exception consumerhandler- an exception handler- Returns:
- a standard object/long consumer
-
cast
public static <T,TT extends T> Consumer<TT> cast(Consumer<T> consumer)
Returns aConsumerwith identical behavior to the specifiedConsumerbut with restricted parameter type.- Type Parameters:
T- the parameter typeTT- the restricted parameter type- Parameters:
consumer- a consumer- Returns:
- a functionally equivalent consumer
-
cast
public static <T,TT extends T> Predicate<TT> cast(Predicate<T> predicate)
Returns aPredicatewith identical behavior to the specifiedPredicatebut with restricted parameter type.- Type Parameters:
T- the parameter typeTT- the restricted parameter type- Parameters:
predicate- a predicate- Returns:
- a functionally equivalent predicate
-
cast
public static <T extends TT,TT> Supplier<TT> cast(Supplier<T> supplier)
- Type Parameters:
T- the return typeTT- the relaxed return type- Parameters:
supplier- a supplier- Returns:
- a functionally equivalent supplier
-
cast
public static <T,R extends RR,TT extends T,RR> Function<TT,RR> cast(Function<T,R> function)
Returns aFunctionwith identical behavior to the specifiedFunctionbut with restricted parameter type and relaxed return type.- Type Parameters:
T- the parameter typeR- the return typeTT- the restricted parameter typeRR- the relaxed return type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <R extends RR,RR> DoubleFunction<RR> cast(DoubleFunction<R> function)
Returns aDoubleFunctionwith identical behavior to the specifiedDoubleFunctionbut with relaxed return type.- Type Parameters:
R- the return typeRR- the relaxed return type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <R extends RR,RR> IntFunction<RR> cast(IntFunction<R> function)
Returns aIntFunctionwith identical behavior to the specifiedIntFunctionbut with relaxed return type.- Type Parameters:
R- the return typeRR- the relaxed return type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <R extends RR,RR> LongFunction<RR> cast(LongFunction<R> function)
Returns aLongFunctionwith identical behavior to the specifiedLongFunctionbut with relaxed return type.- Type Parameters:
R- the return typeRR- the relaxed return type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,TT extends T> ToDoubleFunction<TT> cast(ToDoubleFunction<T> function)
Returns aToDoubleFunctionwith identical behavior to the specifiedToDoubleFunctionbut with restricted parameter type.- Type Parameters:
T- the parameter typeTT- the restricted parameter type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,TT extends T> ToIntFunction<TT> cast(ToIntFunction<T> function)
Returns aToIntFunctionwith identical behavior to the specifiedToIntFunctionbut with restricted parameter type.- Type Parameters:
T- the parameter typeTT- the restricted parameter type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,TT extends T> ToLongFunction<TT> cast(ToLongFunction<T> function)
Returns aToLongFunctionwith identical behavior to the specifiedToLongFunctionbut with restricted parameter type.- Type Parameters:
T- the parameter typeTT- the restricted parameter type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,U,TT extends T,UU extends U> BiConsumer<TT,UU> cast(BiConsumer<T,U> consumer)
Returns aBiConsumerwith identical behavior to the specifiedBiConsumerbut with restricted parameter types.- Type Parameters:
T- the first parameter typeU- the second parameter typeTT- the restricted first parameter typeUU- the restricted second parameter type- Parameters:
consumer- a consumer- Returns:
- a functionally equivalent consumer
-
cast
public static <T,TT extends T> ObjDoubleConsumer<TT> cast(ObjDoubleConsumer<T> consumer)
Returns aObjDoubleConsumerwith identical behavior to the specifiedObjDoubleConsumerbut with restricted parameter type.- Type Parameters:
T- the parameter typeTT- the restricted parameter type- Parameters:
consumer- a consumer- Returns:
- a functionally equivalent consumer
-
cast
public static <T,TT extends T> ObjIntConsumer<TT> cast(ObjIntConsumer<T> consumer)
Returns aObjIntConsumerwith identical behavior to the specifiedObjIntConsumerbut with restricted parameter type.- Type Parameters:
T- the parameter typeTT- the restricted parameter type- Parameters:
consumer- a consumer- Returns:
- a functionally equivalent consumer
-
cast
public static <T,TT extends T> ObjLongConsumer<TT> cast(ObjLongConsumer<T> consumer)
Returns aObjLongConsumerwith identical behavior to the specifiedObjLongConsumerbut with restricted parameter type.- Type Parameters:
T- the parameter typeTT- the restricted parameter type- Parameters:
consumer- a consumer- Returns:
- a functionally equivalent consumer
-
cast
public static <T,U,TT extends T,UU extends U> BiPredicate<TT,UU> cast(BiPredicate<T,U> predicate)
Returns aBiPredicatewith identical behavior to the specifiedBiPredicatebut with restricted parameter types.- Type Parameters:
T- the first parameter typeU- the second parameter typeTT- the restricted first parameter typeUU- the restricted second parameter type- Parameters:
predicate- a predicate- Returns:
- a functionally equivalent predicate
-
cast
public static <T,U,R extends RR,TT extends T,UU extends U,RR> BiFunction<TT,UU,RR> cast(BiFunction<T,U,R> function)
Returns aBiFunctionwith identical behavior to the specifiedBiFunctionbut with restricted parameter types and relaxed return type.- Type Parameters:
T- the first parameter typeU- the second parameter typeR- the return typeTT- the restricted first parameter typeUU- the restricted second parameter typeRR- the relaxed return type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,U,TT extends T,UU extends U> ToDoubleBiFunction<TT,UU> cast(ToDoubleBiFunction<T,U> function)
Returns aToDoubleBiFunctionwith identical behavior to the specifiedToDoubleBiFunctionbut with restricted parameter types.- Type Parameters:
T- the first parameter typeU- the second parameter typeTT- the restricted first parameter typeUU- the restricted second parameter type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,U,TT extends T,UU extends U> ToIntBiFunction<TT,UU> cast(ToIntBiFunction<T,U> function)
Returns aToIntBiFunctionwith identical behavior to the specifiedToIntBiFunctionbut with restricted parameter types.- Type Parameters:
T- the first parameter typeU- the second parameter typeTT- the restricted first parameter typeUU- the restricted second parameter type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,U,TT extends T,UU extends U> ToLongBiFunction<TT,UU> cast(ToLongBiFunction<T,U> function)
Returns aToLongBiFunctionwith identical behavior to the specifiedToLongBiFunctionbut with restricted parameter types.- Type Parameters:
T- the first parameter typeU- the second parameter typeTT- the restricted first parameter typeUU- the restricted second parameter type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,E extends EE,TT extends T,EE extends Exception> ExceptionConsumer<TT,EE> cast(ExceptionConsumer<T,E> consumer)
Returns aExceptionConsumerwith identical behavior to the specifiedExceptionConsumerbut with restricted parameter type and relaxed exception type.- Type Parameters:
T- the parameter typeE- the exception typeTT- the restricted parameter typeEE- the relaxed exception type- Parameters:
consumer- a consumer- Returns:
- a functionally equivalent consumer
-
cast
public static <T,E extends EE,TT extends T,EE extends Exception> ExceptionPredicate<TT,EE> cast(ExceptionPredicate<T,E> consumer)
Returns aExceptionPredicatewith identical behavior to the specifiedExceptionPredicatebut with restricted parameter type and relaxed exception type.- Type Parameters:
T- the parameter typeE- the exception typeTT- the restricted parameter typeEE- the relaxed exception type- Parameters:
consumer- a consumer- Returns:
- a functionally equivalent predicate
-
cast
public static <T extends TT,E extends EE,TT,EE extends Exception> ExceptionSupplier<TT,EE> cast(ExceptionSupplier<T,E> supplier)
Returns aExceptionSupplierwith identical behavior to the specifiedExceptionSupplierbut with relaxed return type and relaxed exception type.- Type Parameters:
T- the return typeE- the exception typeTT- the relaxed return typeEE- the relaxed exception type- Parameters:
supplier- a supplier- Returns:
- a functionally equivalent supplier
-
cast
public static <T,R extends RR,E extends EE,TT extends T,RR,EE extends Exception> ExceptionFunction<TT,RR,EE> cast(ExceptionFunction<T,R,E> function)
Returns aExceptionFunctionwith identical behavior to the specifiedExceptionFunctionbut with restricted parameter type, relaxed return type, and relaxed exception type.- Type Parameters:
T- the parameter typeR- the return typeE- the exception typeTT- the restricted parameter typeRR- the relaxed return typeEE- the relaxed exception type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <R extends RR,E extends EE,RR,EE extends Exception> ExceptionIntFunction<RR,EE> cast(ExceptionIntFunction<R,E> function)
Returns aExceptionIntFunctionwith identical behavior to the specifiedExceptionFunctionbut with relaxed return type and relaxed exception type.- Type Parameters:
R- the return typeE- the exception typeRR- the relaxed return typeEE- the relaxed exception type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <R extends RR,E extends EE,RR,EE extends Exception> ExceptionLongFunction<RR,EE> cast(ExceptionLongFunction<R,E> function)
Returns aExceptionLongFunctionwith identical behavior to the specifiedExceptionLongFunctionbut with relaxed return type and relaxed exception type.- Type Parameters:
R- the return typeE- the exception typeRR- the relaxed return typeEE- the relaxed exception type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,E extends EE,TT extends T,EE extends Exception> ExceptionToIntFunction<TT,EE> cast(ExceptionToIntFunction<T,E> function)
Returns aExceptionToIntFunctionwith identical behavior to the specifiedExceptionToIntFunctionbut with restricted parameter type and relaxed exception type.- Type Parameters:
T- the parameter typeE- the exception typeTT- the restricted parameter typeEE- the relaxed exception type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,E extends EE,TT extends T,EE extends Exception> ExceptionToLongFunction<TT,EE> cast(ExceptionToLongFunction<T,E> function)
Returns aExceptionToLongFunctionwith identical behavior to the specifiedExceptionToLongFunctionbut with restricted parameter type and relaxed exception type.- Type Parameters:
T- the parameter typeE- the exception typeTT- the restricted parameter typeEE- the relaxed exception type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,E extends EE,TT extends T,U,UU extends U,EE extends Exception> ExceptionBiConsumer<TT,UU,EE> cast(ExceptionBiConsumer<T,U,E> consumer)
Returns aExceptionBiConsumerwith identical behavior to the specifiedExceptionBiConsumerbut with restricted parameter types and relaxed exception type.- Type Parameters:
T- the first parameter typeU- the second parameter typeE- the exception typeTT- the restricted first parameter typeUU- the restricted second parameter typeEE- the relaxed exception type- Parameters:
consumer- a consumer- Returns:
- a functionally equivalent consumer
-
cast
public static <T,E extends EE,TT extends T,EE extends Exception> ExceptionObjIntConsumer<TT,EE> cast(ExceptionObjIntConsumer<T,E> consumer)
Returns aExceptionObjIntConsumerwith identical behavior to the specifiedExceptionObjIntConsumerbut with restricted parameter type and relaxed exception type.- Type Parameters:
T- the parameter typeE- the exception typeTT- the restricted parameter typeEE- the relaxed exception type- Parameters:
consumer- a consumer- Returns:
- a functionally equivalent consumer
-
cast
public static <T,E extends EE,TT extends T,EE extends Exception> ExceptionObjLongConsumer<TT,EE> cast(ExceptionObjLongConsumer<T,E> consumer)
Returns aExceptionObjLongConsumerwith identical behavior to the specifiedExceptionObjLongConsumerbut with restricted parameter type and relaxed exception type.- Type Parameters:
T- the parameter typeE- the exception typeTT- the restricted parameter typeEE- the relaxed exception type- Parameters:
consumer- a consumer- Returns:
- a functionally equivalent consumer
-
cast
public static <T,U,E extends EE,TT extends T,UU extends U,EE extends Exception> ExceptionBiPredicate<TT,UU,EE> cast(ExceptionBiPredicate<T,U,E> predicate)
Returns aExceptionBiPredicatewith identical behavior to the specifiedExceptionBiPredicatebut with restricted parameter types and relaxed exception type.- Type Parameters:
T- the first parameter typeU- the second parameter typeE- the exception typeTT- the restricted first parameter typeUU- the restricted second parameter typeEE- the relaxed exception type- Parameters:
predicate- a predicate- Returns:
- a functionally equivalent predicate
-
cast
public static <T,U,R extends RR,E extends EE,TT extends T,UU extends U,RR,EE extends Exception> ExceptionBiFunction<TT,UU,RR,EE> cast(ExceptionBiFunction<T,U,R,E> function)
Returns aExceptionBiFunctionwith identical behavior to the specifiedExceptionBiFunctionbut with restricted parameter types, relaxed return type, and relaxed exception type.- Type Parameters:
T- the first parameter typeU- the second parameter typeR- the return typeE- the exception typeTT- the restricted first parameter typeUU- the restricted second parameter typeRR- the relaxed return typeEE- the relaxed exception type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,U,E extends EE,TT extends T,UU extends U,EE extends Exception> ExceptionToIntBiFunction<TT,UU,EE> cast(ExceptionToIntBiFunction<T,U,E> function)
Returns aExceptionToIntBiFunctionwith identical behavior to the specifiedExceptionToIntBiFunctionbut with restricted parameter types and relaxed exception type.- Type Parameters:
T- the first parameter typeU- the second parameter typeE- the exception typeTT- the restricted first parameter typeUU- the restricted second parameter typeEE- the relaxed exception type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
cast
public static <T,U,E extends EE,TT extends T,UU extends U,EE extends Exception> ExceptionToLongBiFunction<TT,UU,EE> cast(ExceptionToLongBiFunction<T,U,E> function)
Returns aExceptionToLongBiFunctionwith identical behavior to the specifiedExceptionToLongBiFunctionbut with restricted parameter types and relaxed exception type.- Type Parameters:
T- the first parameter typeU- the second parameter typeE- the exception typeTT- the restricted first parameter typeUU- the restricted second parameter typeEE- the relaxed exception type- Parameters:
function- a function- Returns:
- a functionally equivalent function
-
-