at.molindo.utils.collections
Class CollectionUtils
java.lang.Object
at.molindo.utils.collections.CollectionUtils
public class CollectionUtils
- extends Object
|
Method Summary |
static
|
add(C to,
F o,
Function<? super F,T> f)
|
static
|
addAll(C to,
Collection<? extends F> from,
Function<? super F,T> f)
|
static boolean |
empty(Collection<?> c)
|
static boolean |
empty(Map<?,?> c)
|
static
|
find(Collection<T> c,
Function<T,Boolean> f)
|
static
|
find(Collection<T> c,
Function<T,V> f,
V match)
|
static
|
findAll(Collection<T> c,
Function<T,Boolean> f)
|
static
|
findAll(Collection<T> c,
Function<T,V> f,
V match)
|
static
|
first(Iterable<T> c)
|
static
|
first(Map<K,V> c)
|
static
|
firstKey(Map<K,?> c)
|
static
|
firstValue(Map<?,V> c)
|
static
|
list(E... e)
|
static
|
list(Iterable<E> e)
|
static
<M extends Map<T,F>,T,F>
M |
|
put(M to,
F o,
Function<? super F,T> f)
|
static
<M extends Map<T,F>,T,F>
M |
|
putAll(M to,
Collection<? extends F> from,
Function<? super F,T> f)
|
static
|
putIfAbsent(ConcurrentMap<K,V> map,
K key,
V value)
|
static
|
resize(List<T> list,
int size)
|
static
|
resize(List<T> list,
int size,
T defaultValue)
|
static
|
resize(List<T> list,
int size,
T defaultValue,
Collection<T> obsolete)
|
static
|
set(E... e)
|
static
|
set(Iterable<E> e)
|
static
|
set(List<T> list,
int idx,
T obj)
set index of list to obj, resizing list if necessary |
static
|
set(List<T> list,
int idx,
T obj,
T defaultValue)
|
static
|
sortedSet(E... e)
|
static
|
sortedSet(Iterable<E> e)
|
static
|
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
|
unmodifiableList(E... e)
|
static
|
unmodifiableList(Iterable<E> e)
|
static
|
unmodifiableSet(E... e)
|
static
|
unmodifiableSet(Iterable<E> e)
|
static
|
unmodifiableSortedSet(E... e)
|
static
|
unmodifiableSortedSet(Iterable<E> e)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
unmodifiableSet
public static <E> Set<E> unmodifiableSet(Iterable<E> e)
unmodifiableSet
public static <E> Set<E> unmodifiableSet(E... e)
set
public static <E> HashSet<E> set(E... e)
set
public static <E> HashSet<E> set(Iterable<E> e)
unmodifiableSortedSet
public static <E> SortedSet<E> unmodifiableSortedSet(E... e)
unmodifiableSortedSet
public static <E> SortedSet<E> unmodifiableSortedSet(Iterable<E> e)
sortedSet
public static <E> TreeSet<E> sortedSet(E... e)
sortedSet
public static <E> TreeSet<E> sortedSet(Iterable<E> e)
unmodifiableList
public static <E> List<E> unmodifiableList(E... e)
unmodifiableList
public static <E> List<E> unmodifiableList(Iterable<E> e)
list
public static <E> ArrayList<E> list(E... e)
list
public static <E> ArrayList<E> list(Iterable<E> e)
subList
public 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
empty
public static boolean empty(Collection<?> c)
empty
public static boolean empty(Map<?,?> c)
first
public static <T> T first(Iterable<T> c)
first
public static <K,V> Map.Entry<K,V> first(Map<K,V> c)
firstKey
public static <K> K firstKey(Map<K,?> c)
firstValue
public static <V> V firstValue(Map<?,V> c)
putIfAbsent
public static <K,V> V putIfAbsent(ConcurrentMap<K,V> map,
K key,
V value)
find
public static <T,V> T find(Collection<T> c,
Function<T,Boolean> f)
findAll
public static <T,V> List<T> findAll(Collection<T> c,
Function<T,Boolean> f)
find
public static <T,V> T find(Collection<T> c,
Function<T,V> f,
V match)
findAll
public static <T,V> List<T> findAll(Collection<T> c,
Function<T,V> f,
V match)
add
public static <C extends Collection<T>,T,F> C add(C to,
F o,
Function<? super F,T> f)
addAll
public static <C extends Collection<T>,T,F> C addAll(C to,
Collection<? extends F> from,
Function<? super F,T> f)
put
public static <M extends Map<T,F>,T,F> M put(M to,
F o,
Function<? super F,T> f)
putAll
public static <M extends Map<T,F>,T,F> M putAll(M to,
Collection<? extends F> from,
Function<? super F,T> f)
resize
public static <T> List<T> resize(List<T> list,
int size)
resize
public static <T> List<T> resize(List<T> list,
int size,
T defaultValue)
resize
public static <T> List<T> resize(List<T> list,
int size,
T defaultValue,
Collection<T> obsolete)
set
public static <T> List<T> set(List<T> list,
int idx,
T obj)
- set index of list to obj, resizing list if necessary
- Type Parameters:
T - - Parameters:
list - idx - obj -
- Returns:
set
public static <T> List<T> set(List<T> list,
int idx,
T obj,
T defaultValue)
Copyright © 2013 Molindo GmbH. All Rights Reserved.