public class NullStrategy
extends java.lang.Object
Class provides functional methods to transform arrays or collections to append a null value to it.
Each instance provides two methods:
Each method applies functionality specific to a strategy. Currently there're these options: Also for manual use there're some static methods available:| Modifier and Type | Field and Description |
|---|---|
static NullStrategy |
NO_STRATEGY
No strategy is applied.
|
static NullStrategy |
NULLABLE_END
If specified set contains
null as a last element - nothing happens. |
static NullStrategy |
NULLABLE_START
If specified set contains
null as a first element - nothing happens. |
| Modifier and Type | Method and Description |
|---|---|
<T> java.util.List<T> |
apply(java.util.Collection<T> col)
Specified collection is copied into a list in any case.
|
<T> T[] |
apply(T[] arr)
Specified array is cloned in any case.
|
static <T> java.util.List<T> |
nullableEnd(java.util.Collection<T> col)
Equal to the
NULLABLE_END strategy. |
static <T> java.util.List<T> |
nullableStart(java.util.Collection<T> col)
Equal to the
NULLABLE_START strategy. |
public static NullStrategy NO_STRATEGY
No strategy is applied.
apply(Object[]) specified array will be cloned without any changes.
apply(Collection) specified collection will be transformed into a list without any other changes.
public static NullStrategy NULLABLE_START
If specified set contains null as a first element - nothing happens.
Otherwise - null is appended at the beginning of a set.
apply(Object[]),
apply(Collection)public static NullStrategy NULLABLE_END
If specified set contains null as a last element - nothing happens.
Otherwise - null is appended at the end of a set.
apply(Object[]),
apply(Collection)public <T> T[] apply(T[] arr)
public <T> java.util.List<T> apply(java.util.Collection<T> col)
public static <T> java.util.List<T> nullableStart(java.util.Collection<T> col)
Equal to the NULLABLE_START strategy.
Specified Collection is copied into a list in any case.
public static <T> java.util.List<T> nullableEnd(java.util.Collection<T> col)
Equal to the NULLABLE_END strategy.
Specified Collection is copied into a list in any case.