public class WeldCollections extends Object
Modifier and Type | Field and Description |
---|---|
static Map<Object,List<Object>> |
EMPTY_ARRAY_SET_MULTIMAP |
Modifier and Type | Method and Description |
---|---|
static <E> boolean |
addAll(Collection<E> collection,
E... elements) |
static <T> boolean |
addIfNotNull(Collection<T> collection,
T element) |
static <T> List<T> |
immutableGuavaList(List<T> list)
Returns an immutable view of a given list.
|
static <T> Set<T> |
immutableGuavaSet(Set<T> set)
Returns an immutable view of a given set.
|
static <T> List<T> |
immutableList(List<T> list)
Returns an immutable view of a given list.
|
static <K,V> Map<K,V> |
immutableMap(Map<K,V> map)
Returns an immutable view of a given map.
|
static <T> Set<T> |
immutableSet(Set<T> set)
Returns an immutable view of a given set.
|
static <K,V> V |
putIfAbsent(ConcurrentMap<K,V> map,
K key,
V value)
Utility method for working with maps.
|
static <T> List<T> |
sort(List<T> list,
Comparator<? super T> comparator)
Fluent version of
Collections.sort(List, Comparator) |
static String |
toMultiRowString(Collection<?> collection)
Returns the supplied collection as a multi-row string with every toString() of every element of the collection
in its own row.
|
public static <T> Set<T> immutableSet(Set<T> set)
ArraySet
, it is trimmed.public static <T> Set<T> immutableGuavaSet(Set<T> set)
public static <T> List<T> immutableList(List<T> list)
ArrayList
, it is trimmed.public static <T> List<T> immutableGuavaList(List<T> list)
public static <K,V> Map<K,V> immutableMap(Map<K,V> map)
public static <T> List<T> sort(List<T> list, Comparator<? super T> comparator)
Collections.sort(List, Comparator)
public static String toMultiRowString(Collection<?> collection)
- aaa, - bbb, - ccc
public static <E> boolean addAll(Collection<E> collection, E... elements)
collection
- elements
- public static <T> boolean addIfNotNull(Collection<T> collection, T element)
public static <K,V> V putIfAbsent(ConcurrentMap<K,V> map, K key, V value)
Map.putIfAbsent(Object, Object)
this method always returns the value that ends up store in the map
which is either the old value (if any was present) or the new value (if it was stored in the map).map
- the mapkey
- the keyvalue
- the valueCopyright © 2019. All rights reserved.