public final class CollectionUtils
extends java.lang.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> |
Modifier and Type | Method and Description |
---|---|
static <E> CollectionUtils.ListBuilder<E> |
list() |
static <E> CollectionUtils.ListBuilder<E> |
list(java.util.List<E> delegate) |
static <K,V> CollectionUtils.MapBuilder<K,V> |
map() |
static <K,V> CollectionUtils.MapBuilder<K,V> |
map(java.util.Map<K,V> delegate) |
static <T> java.util.List<T> |
newList(T... values) |
static <K,V> java.util.Map |
newMap(java.lang.Object... keysAndValues) |
static <T> java.util.Set<T> |
newSet(T... values) |
static <T> java.util.List<T> |
reverse(java.util.Collection<T> input) |
static <T> java.util.List<T> |
reverse(java.util.List<T> input) |
static <E> CollectionUtils.SetBuilder<E> |
set() |
static <E> CollectionUtils.SetBuilder<E> |
set(java.util.Set<E> delegate) |
static java.util.Properties |
toProperties(java.util.Map<java.lang.String,java.lang.Object> map)
Returns an adapted Map as a Properties instance.
|
static java.util.Properties |
toPropertiesDeep(java.util.Map<java.lang.String,java.lang.Object> map)
Creates a Properties instances based on the given Map.
|
public static <T> java.util.List<T> reverse(java.util.List<T> input)
public static <T> java.util.List<T> reverse(java.util.Collection<T> input)
public static <K,V> java.util.Map newMap(java.lang.Object... keysAndValues)
@SafeVarargs public static <T> java.util.Set<T> newSet(T... values)
@SafeVarargs public static <T> java.util.List<T> newList(T... values)
public static <K,V> CollectionUtils.MapBuilder<K,V> map()
public static <K,V> CollectionUtils.MapBuilder<K,V> map(java.util.Map<K,V> delegate)
public static <E> CollectionUtils.ListBuilder<E> list()
public static <E> CollectionUtils.ListBuilder<E> list(java.util.List<E> delegate)
public static <E> CollectionUtils.SetBuilder<E> set()
public static <E> CollectionUtils.SetBuilder<E> set(java.util.Set<E> delegate)
@Nonnull public static java.util.Properties toProperties(@Nonnull java.util.Map<java.lang.String,java.lang.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 java.util.Properties toPropertiesDeep(@Nonnull java.util.Map<java.lang.String,java.lang.Object> map)
map
- the Map instance to convert as a Properties instance