Modifier and Type | Field and Description |
---|---|
static JavaUtils |
INSTANCE
The singleton instance of this utility class.
|
Modifier and Type | Method and Description |
---|---|
<T> JavaUtils |
acceptIfCondition(boolean condition,
T value,
java.util.function.Consumer<T> consumer)
Invoke
Consumer.accept(Object) with the value if the condition is true. |
<T> JavaUtils |
acceptIfNotNull(T value,
java.util.function.Consumer<T> consumer)
Invoke
Consumer.accept(Object) with the value if it is not null. |
public static final JavaUtils INSTANCE
public <T> JavaUtils acceptIfCondition(boolean condition, T value, java.util.function.Consumer<T> consumer)
Consumer.accept(Object)
with the value if the condition is true.T
- the value type.condition
- the condition.value
- the value.consumer
- the consumer.public <T> JavaUtils acceptIfNotNull(T value, java.util.function.Consumer<T> consumer)
Consumer.accept(Object)
with the value if it is not null.T
- the value type.value
- the value.consumer
- the consumer.