Package utility.function
Interface Callback
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Callback
A generic functional interface that is more semantically sound thanRunnable
. Use anywhere you wish to have a generic callback function.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description void
call()
The method that will be called.static Callback
dummy()
Creates a dummy callback function.static Callback
dummyIfNull(Callback c)
Returns the given callback object if it is not null.
-
-
-
Method Detail
-
dummy
static Callback dummy()
Creates a dummy callback function. This is useful to avoid using null.- Returns:
- a dummy callback function
-
dummyIfNull
static Callback dummyIfNull(Callback c)
Returns the given callback object if it is not null. Otherwise, adummy()
callback is returned. This is useful to avoid using null.- Parameters:
c
- the callback function to check for null- Returns:
- a non-null callback function
-
call
void call()
The method that will be called.
-
-