|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openwms.core.util.lang.CollectionUtil
public final class CollectionUtil
A CollectionUtil.
Method Summary | ||
---|---|---|
static
|
asHashMap(List<V> list,
ListExtractor<K,V> extractor)
Convert a list into a LinkedHashMap using a ListExtractor
to determine the keys and values for the new Map. |
|
static
|
getFirstOrNull(List<T> list)
Return the first element of list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> T getFirstOrNull(List<T> list)
null
of empty,
null
is returned.
T
- Any typelist
- The List
null
if list == null || list.isEmptypublic static <K,V> Map<K,V> asHashMap(List<V> list, ListExtractor<K,V> extractor)
LinkedHashMap
using a ListExtractor
to determine the keys and values for the new Map.
K
- Type of list keyV
- Type of list valuelist
- The list to convertextractor
- To determine key and value for each list entry
LinkedHashMap
or an empty map when one of the
arguments is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |