public class CollectionUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <C extends Collection<T>,T,F> |
add(C to,
F o,
Function<? super F,T> f) |
static <C extends Collection<T>,T,F> |
addAll(C to,
Collection<? extends F> from,
Function<? super F,T> f) |
static boolean |
empty(Collection<?> c) |
static boolean |
empty(Map<?,?> c) |
static <T,V> T |
find(Collection<T> c,
Function<T,Boolean> f) |
static <T,V> T |
find(Collection<T> c,
Function<T,V> f,
V match) |
static <T,V> List<T> |
findAll(Collection<T> c,
Function<T,Boolean> f) |
static <T,V> List<T> |
findAll(Collection<T> c,
Function<T,V> f,
V match) |
static <T> T |
first(Iterable<T> c) |
static <K,V> Map.Entry<K,V> |
first(Map<K,V> c) |
static <K> K |
firstKey(Map<K,?> c) |
static <V> V |
firstValue(Map<?,V> c) |
static <E> ArrayList<E> |
list(E... e) |
static <E> ArrayList<E> |
list(Iterable<E> e) |
static <K,V> HashMap<K,V> |
mapKeys(Iterable<K> e,
Function<K,V> f) |
static <K,V> HashMap<K,V> |
mapValues(Iterable<V> e,
Function<V,K> f) |
static <M extends Map<T,F>,T,F> |
put(M to,
F o,
Function<? super F,T> f) |
static <M extends Map<T,F>,T,F> |
putAll(M to,
Collection<? extends F> from,
Function<? super F,T> f) |
static <K,V> V |
putIfAbsent(ConcurrentMap<K,V> map,
K key,
V value) |
static <T> void |
remove(Iterable<T> collection,
Function<T,Boolean> function) |
static <T> List<T> |
resize(List<T> list,
int size) |
static <T> List<T> |
resize(List<T> list,
int size,
T defaultValue) |
static <T> List<T> |
resize(List<T> list,
int size,
T defaultValue,
Collection<T> obsolete) |
static <E> HashSet<E> |
set(E... e) |
static <E> HashSet<E> |
set(Iterable<E> e) |
static <T> List<T> |
set(List<T> list,
int idx,
T obj)
set index of list to obj, resizing list if necessary
|
static <T> List<T> |
set(List<T> list,
int idx,
T obj,
T defaultValue) |
static <E> TreeSet<E> |
sortedSet(E... e) |
static <E> TreeSet<E> |
sortedSet(Iterable<E> e) |
static <T> List<T> |
subList(List<T> list,
int first,
int count)
a sublist implementation that is diffrent from
List.subList(int, int) as it handles out of bounds indexes
gracefully |
static <E,T> ArrayList<E> |
transformList(Iterable<T> e,
Function<T,E> f) |
static <E,T> HashSet<E> |
transformSet(Iterable<T> e,
Function<T,E> f) |
static <E,T> TreeSet<E> |
transformSortedSet(Iterable<T> e,
Function<T,E> f) |
static <E,T> List<E> |
transformUnmodifiableList(Iterable<T> e,
Function<T,E> f) |
static <E,T> Set<E> |
transformUnmodifiableSet(Iterable<T> e,
Function<T,E> f) |
static <E,T> SortedSet<E> |
transformUnmodifiableSortedSet(Iterable<T> e,
Function<T,E> f) |
static <E> List<E> |
unmodifiableList(E... e) |
static <E> List<E> |
unmodifiableList(Iterable<E> e) |
static <E> Set<E> |
unmodifiableSet(E... e) |
static <E> Set<E> |
unmodifiableSet(Iterable<E> e) |
static <E> SortedSet<E> |
unmodifiableSortedSet(E... e) |
static <E> SortedSet<E> |
unmodifiableSortedSet(Iterable<E> e) |
public static <E> Set<E> unmodifiableSet(E... e)
public static <E,T> Set<E> transformUnmodifiableSet(Iterable<T> e, Function<T,E> f)
public static <E> HashSet<E> set(E... e)
public static <E> SortedSet<E> unmodifiableSortedSet(E... e)
public static <E,T> SortedSet<E> transformUnmodifiableSortedSet(Iterable<T> e, Function<T,E> f)
public static <E> TreeSet<E> sortedSet(E... e)
public static <E,T> TreeSet<E> transformSortedSet(Iterable<T> e, Function<T,E> f)
public static <E> List<E> unmodifiableList(E... e)
public static <E,T> List<E> transformUnmodifiableList(Iterable<T> e, Function<T,E> f)
public static <E> ArrayList<E> list(E... e)
public static <T> List<T> subList(List<T> list, int first, int count)
List.subList(int, int) as it handles out of bounds indexes
gracefullypublic static boolean empty(Collection<?> c)
public static boolean empty(Map<?,?> c)
public static <T> T first(Iterable<T> c)
public static <K> K firstKey(Map<K,?> c)
public static <V> V firstValue(Map<?,V> c)
public static <K,V> V putIfAbsent(ConcurrentMap<K,V> map, K key, V value)
public static <T,V> T find(Collection<T> c, Function<T,Boolean> f)
public static <T,V> List<T> findAll(Collection<T> c, Function<T,Boolean> f)
public static <T,V> T find(Collection<T> c, Function<T,V> f, V match)
public static <T,V> List<T> findAll(Collection<T> c, Function<T,V> f, V match)
public static <C extends Collection<T>,T,F> C add(C to, F o, Function<? super F,T> f)
public static <C extends Collection<T>,T,F> C addAll(C to, Collection<? extends F> from, Function<? super F,T> f)
public static <M extends Map<T,F>,T,F> M putAll(M to, Collection<? extends F> from, Function<? super F,T> f)
public static <T> List<T> resize(List<T> list, int size, T defaultValue, Collection<T> obsolete)
public static <T> List<T> set(List<T> list, int idx, T obj)
T - list - idx - obj - Copyright © 2014 Molindo GmbH. All Rights Reserved.