Package utility.function
Class Dummy
java.lang.Object
utility.function.Dummy
A utility class to help create dummy stub functional interfaces
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,U> BiConsumer<T, U> Creates a dummy consumerstatic Callbackcallback()Creates a dummy callbackstatic <T> Consumer<T>consumer()Creates a dummy consumerstatic <T,R> Function<T, R> function()Creates a dummy functionstatic RunnableReturns the given runnable object if it is notnull.static <T,U> BiConsumer<T, U> ifNull(BiConsumer<T, U> c) Returns the given consumer object if it is notnull.static <T> Consumer<T>Returns the given consumer object if it is notnull.static <T,R> Function<T, R> Returns the given function object if it is notnull.static <T> Supplier<T>Returns the given callback object if it is notnull.static CallbackReturns the given callback object if it is notnull.static Runnablerunnable()Creates a dummy runnablestatic <T> Supplier<T>supplier()Creates a dummy supplier
-
Constructor Details
-
Dummy
public Dummy()
-
-
Method Details
-
callback
Creates a dummy callback- Returns:
- a dummy callback
-
consumer
Creates a dummy consumer- Returns:
- a dummy consumer
-
biConsumer
Creates a dummy consumer- Returns:
- a dummy consumer
-
function
Creates a dummy function- Type Parameters:
T- the input typeR- the result type- Returns:
- the function
-
supplier
Creates a dummy supplier- Type Parameters:
T- the result type- Returns:
- the supplier
-
runnable
Creates a dummy runnable- Returns:
- the runnable
-
ifNull
Returns the given consumer object if it is notnull. Otherwise, aconsumer()is returned. This is useful to avoid usingnull.- Parameters:
c- the consumer function to check fornull- Returns:
- a non-null consumer
-
ifNull
Returns the given consumer object if it is notnull. Otherwise, abiConsumer()is returned. This is useful to avoid usingnull.- Parameters:
c- the consumer function to check fornull- Returns:
- a non-null consumer
-
ifNull
Returns the given callback object if it is notnull. Otherwise, acallback()is returned. This is useful to avoid usingnull.- Parameters:
c- the callback function to check fornull- Returns:
- a non-null callback function
-
ifNull
Returns the given function object if it is notnull. Otherwise, afunction()is returned. This is useful to avoid usingnull.- Type Parameters:
T- the input typeR- the result type- Parameters:
f- the function to check fornull- Returns:
- a non-null function
-
ifNull
Returns the given callback object if it is notnull. Otherwise, acallback()is returned. This is useful to avoid usingnull.- Parameters:
s- the supplier function to check fornull- Returns:
- a non-null supplier
-
ifNull
Returns the given runnable object if it is notnull. Otherwise, arunnable()is returned. This is useful to avoid usingnull.- Parameters:
r- the runnable function to check fornull- Returns:
- a non-null runnable
-