public final class CollectionUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> boolean |
isEmpty(Collection<T> parameter)
Checks if the collection is null or empty.
|
static <T> boolean |
isNotEmpty(Collection<T> parameter)
Checks if the collection is not null and not empty.
|
static <T> T[] |
nullToEmpty(T[] array)
Return an empty array if input is null; works as identity function otherwise.
|
public static <T> boolean isEmpty(Collection<T> parameter)
T
- a type of element of collectionparameter
- the collectionpublic static <T> boolean isNotEmpty(Collection<T> parameter)
T
- a type of element of collectionparameter
- the collectionpublic static <T> T[] nullToEmpty(T[] array)
T
- Type of the elements of the array.array
- Input array. Can be null.Copyright © 2017 The Apache Software Foundation. All rights reserved.