public final class Lists extends Object
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
create(T item)
Creates a new List with the given item as the first entry.
|
static <T> List<T> |
createWhenNull(List<T> list)
Returns the list when it is not null.
|
static <T> List<T> |
emptyToNull(List<T> list)
Returns null, when the given list is empty or null
|
static <T> T |
firstEntry(List<T> list)
Extracts the first entry of the list when it is not null and contains values.
|
static boolean |
isEmpty(List<?> list)
Checks whether the list is null or empty.
|
static boolean |
isNotEmpty(List<?> list)
Checks whether the list is not null and not empty.
|
static boolean |
sizeIs(List<?> list,
int size)
Checks whether the list has the given size.
|
public static <T> List<T> createWhenNull(List<T> list)
list
- The list to process, can be nullpublic static <T> List<T> create(T item)
item
- The item to add to the new listpublic static <T> T firstEntry(List<T> list)
list
- The list to extract the first entry from, can be nullpublic static boolean isEmpty(List<?> list)
list
- The list to checkpublic static boolean isNotEmpty(List<?> list)
list
- The list to checkpublic static boolean sizeIs(List<?> list, int size)
list
- The list to checksize
- The size to checkCopyright © 2018. All rights reserved.