Modifier and Type | Field and Description |
---|---|
static JavaUtils |
INSTANCE
The singleton instance of this utility class.
|
Modifier and Type | Method and Description |
---|---|
<T1,T2> JavaUtils |
acceptIfCondition(boolean condition,
T1 t1,
T2 t2,
java.util.function.BiConsumer<T1,T2> consumer)
Invoke
BiConsumer.accept(Object, Object) with the arguments if the
condition is true. |
<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. |
JavaUtils |
acceptIfHasText(String value,
java.util.function.Consumer<String> consumer)
Invoke
Consumer.accept(Object) with the value if it is not null or empty. |
<T> JavaUtils |
acceptIfHasText(T t1,
String value,
java.util.function.BiConsumer<T,String> consumer)
Invoke
BiConsumer.accept(Object, Object) with the arguments if the value
argument is not null or empty. |
<T> JavaUtils |
acceptIfNotEmpty(List<T> value,
java.util.function.Consumer<List<T>> consumer)
Invoke
Consumer.accept(Object) with the value if it is not null or empty. |
<T> JavaUtils |
acceptIfNotEmpty(T[] value,
java.util.function.Consumer<T[]> consumer)
Invoke
Consumer.accept(Object) with the value if it is not null or empty. |
<T1,T2> JavaUtils |
acceptIfNotNull(T1 t1,
T2 t2,
java.util.function.BiConsumer<T1,T2> consumer)
Invoke
BiConsumer.accept(Object, Object) with the arguments if the t2
argument is not null. |
<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.public JavaUtils acceptIfHasText(String value, java.util.function.Consumer<String> consumer)
Consumer.accept(Object)
with the value if it is not null or empty.value
- the value.consumer
- the consumer.public <T> JavaUtils acceptIfNotEmpty(List<T> value, java.util.function.Consumer<List<T>> consumer)
Consumer.accept(Object)
with the value if it is not null or empty.T
- the value type.value
- the value.consumer
- the consumer.public <T> JavaUtils acceptIfNotEmpty(T[] value, java.util.function.Consumer<T[]> consumer)
Consumer.accept(Object)
with the value if it is not null or empty.T
- the value type.value
- the value.consumer
- the consumer.public <T1,T2> JavaUtils acceptIfCondition(boolean condition, T1 t1, T2 t2, java.util.function.BiConsumer<T1,T2> consumer)
BiConsumer.accept(Object, Object)
with the arguments if the
condition is true.T1
- the first argument type.T2
- the second argument type.condition
- the condition.t1
- the first consumer argumentt2
- the second consumer argumentconsumer
- the consumer.public <T1,T2> JavaUtils acceptIfNotNull(T1 t1, T2 t2, java.util.function.BiConsumer<T1,T2> consumer)
BiConsumer.accept(Object, Object)
with the arguments if the t2
argument is not null.T1
- the first argument type.T2
- the second argument type.t1
- the first argumentt2
- the second consumer argumentconsumer
- the consumer.public <T> JavaUtils acceptIfHasText(T t1, String value, java.util.function.BiConsumer<T,String> consumer)
BiConsumer.accept(Object, Object)
with the arguments if the value
argument is not null or empty.T
- the first argument type.t1
- the first consumer argument.value
- the second consumer argumentconsumer
- the consumer.