public final class CollectionUtils extends Object
Utility class built on top of the java collection framework helping WUIC to deal with collections.
Modifier and Type | Field and Description |
---|---|
static List<String> |
EMPTY_STRING_LIST
Empty
List typed with String . |
Modifier and Type | Method and Description |
---|---|
static int |
deepHashCode(Object... objects)
Just the varargs version of
Arrays.deepHashCode(Object[])
|
static <T> Set<T> |
difference(Set<T> first,
Set<T> second)
Returns a set containing all the elements which are not contained by the two given sets.
|
static int |
indexOf(Object target,
Object... elements)
Gets the index of a targetted element in a specified array.
|
static <T> List<T> |
newList(T... elements)
Returns a
List with a initial capacity which equals to the number of
elements given in parameter and with those elements already added. |
static <K,V> Map<K,V> |
orderedKeyMap()
Returns a
Map that keep the orders of its keys. |
static <T> void |
without(T[] source,
T[] target,
int... exclusions)
Returns an array without the element at given indexes.
|
public static <T> void without(T[] source, T[] target, int... exclusions)
Returns an array without the element at given indexes.
source
- the source arraytarget
- array to recopy (length should equals source.length - exclusions.length)exclusions
- the indexes to exclude (must appear in natural order)public static <K,V> Map<K,V> orderedKeyMap()
Returns a Map
that keep the orders of its keys.
K
- the type of the keyV
- the type of the valuepublic static <T> List<T> newList(T... elements)
Returns a List
with a initial capacity which equals to the number of
elements given in parameter and with those elements already added.
T
- the generic of the listelements
- the elements to add to the list to createList
public static <T> Set<T> difference(Set<T> first, Set<T> second)
Returns a set containing all the elements which are not contained by the two given sets.
T
- the type of elementfirst
- the first setsecond
- the second setpublic static int deepHashCode(Object... objects)
Just the varargs version of Arrays.deepHashCode(Object[])
objects
- the array to compute hash codeArrays.deepHashCode(Object[])
Copyright © 2012-2015. All Rights Reserved.