public final class CollectionUtils extends Object
Utility class that simplifies creating collections in Java.
Creating Maps
Mapm = map() .e("foo", foo) .e("bar", bar);
Creating Lists
Listl = list() .e("foo") .e("bar");
Creating Maps
Sets = set() .e("foo") .e("bar");
Modifier and Type | Class and Description |
---|---|
static class |
CollectionUtils.ListBuilder<E> |
static class |
CollectionUtils.MapBuilder<K,V> |
static class |
CollectionUtils.SetBuilder<E> |
Constructor and Description |
---|
CollectionUtils() |
Modifier and Type | Method and Description |
---|---|
static <E> CollectionUtils.ListBuilder<E> |
list() |
static <E> CollectionUtils.ListBuilder<E> |
list(List<E> delegate) |
static <K,V> CollectionUtils.MapBuilder<K,V> |
map() |
static <K,V> CollectionUtils.MapBuilder<K,V> |
map(Map<K,V> delegate) |
static <T> List<T> |
newList(T... values) |
static <K,V> Map |
newMap(Object... keysAndValues) |
static <T> Set<T> |
newSet(T... values) |
static <T> List<T> |
reverse(Collection<T> input) |
static <T> List<T> |
reverse(List<T> input) |
static <E> CollectionUtils.SetBuilder<E> |
set() |
static <E> CollectionUtils.SetBuilder<E> |
set(Set<E> delegate) |
static Properties |
toProperties(Map<String,Object> map)
Returns an adapted Map as a Properties instance.
|
static Properties |
toPropertiesDeep(Map<String,Object> map)
Creates a Properties instances based on the given Map.
|
public static <T> List<T> reverse(Collection<T> input)
@SafeVarargs public static <T> Set<T> newSet(T... values)
@SafeVarargs public static <T> List<T> newList(T... values)
public static <K,V> CollectionUtils.MapBuilder<K,V> map()
public static <K,V> CollectionUtils.MapBuilder<K,V> map(Map<K,V> delegate)
public static <E> CollectionUtils.ListBuilder<E> list()
public static <E> CollectionUtils.ListBuilder<E> list(List<E> delegate)
public static <E> CollectionUtils.SetBuilder<E> set()
public static <E> CollectionUtils.SetBuilder<E> set(Set<E> delegate)
@Nonnull public static Properties toProperties(@Nonnull Map<String,Object> map)
The Map is used live, which means changes made to it will affect the Properties instance directly.
map
- the Map instance to adapt as a Properties instance@Nonnull public static Properties toPropertiesDeep(@Nonnull Map<String,Object> map)
map
- the Map instance to convert as a Properties instance