|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alee.utils.CollectionUtils
public final class CollectionUtils
This class provides a set of utilities to work with collections.
Constructor Summary | |
---|---|
CollectionUtils()
|
Method Summary | ||
---|---|---|
static
|
addAll(java.util.Collection<T> collection,
java.util.Collection<T> objects)
Adds all objects into the specified list. |
|
static
|
addAll(java.util.Collection<T> collection,
T... objects)
Adds all objects into the specified list. |
|
static
|
addAllNonNull(java.util.Collection<T> collection,
java.util.Collection<T> objects)
Adds all non-null objects into the specified list. |
|
static
|
addAllNonNull(java.util.Collection<T> collection,
T... objects)
Adds all non-null objects into the specified list. |
|
static boolean |
areEqual(java.util.List list1,
java.util.List list2)
Returns whether lists are equal or not. |
|
static
|
asList(java.util.Iterator<T> data)
Returns data converted into list. |
|
static
|
asList(T... data)
Returns data converted into list. |
|
static
|
clone(java.util.Collection<T> collection)
Returns clone of the specified collection. |
|
static
|
cloneOrCopy(java.util.Collection<T> collection)
Returns collection with clonable values being cloned and non-clonable values simply copied from source collection. |
|
static
|
cloneSubList(java.util.List<T> list,
int fromIndex,
int toIndex)
Returns sub list with cloned values. |
|
static
|
copy(java.util.Collection<T> collection)
Returns copy of the specified list. |
|
static
|
copy(T... data)
Returns data converted into list. |
|
static
|
copySubList(java.util.List<T> list,
int fromIndex,
int toIndex)
Returns sub list with copied values. |
|
static
|
fillList(int amount,
IndexedSupplier<T> supplier)
Fills and returns list with data provided by supplier interface implementation. |
|
static
|
filter(java.util.Collection<T> collection,
Filter<T> filter)
Returns list of elements filtered from collection. |
|
static boolean |
isEmpty(java.util.Collection collection)
Returns whether specified collection is empty or not. |
|
static
|
keysList(java.util.Map<K,V> map)
Returns map keys list. |
|
static
|
limit(java.util.List<T> list,
int limit)
Returns list with limited amount of objects from the initial list. |
|
static
|
removeAll(java.util.Collection<T> collection,
T... objects)
Removes all objects from the specified list. |
|
static
|
removeNulls(java.util.List<T> list)
Removes all null elements from list. |
|
static int[] |
toArray(java.util.List<java.lang.Integer> list)
Returns an int array created using Integer list. |
|
static
|
toList(java.util.Deque<T> deque)
Returns a list of objects converted from deque. |
|
static
|
toList(T[] array)
Returns a list of objects converted from array. |
|
static
|
toStringList(java.util.List<T> list,
TextProvider<T> textProvider)
Returns list of strings extracted from the specified elements list. |
|
static
|
valuesList(java.util.Map<K,V> map)
Returns map values list. |
|
static
|
valuesSummaryList(java.util.Map<K,java.util.List<V>> map)
Returns map values summary list with unique elements only. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CollectionUtils()
Method Detail |
---|
public static boolean isEmpty(java.util.Collection collection)
collection
- collection to process
public static <T> java.util.List<T> limit(java.util.List<T> list, int limit)
T
- object typelist
- initial listlimit
- objects amount limitation
public static <T> java.util.ArrayList<T> copySubList(java.util.List<T> list, int fromIndex, int toIndex)
T
- data typelist
- source listfromIndex
- start indextoIndex
- end index
public static <T extends java.lang.Cloneable> java.util.ArrayList<T> cloneSubList(java.util.List<T> list, int fromIndex, int toIndex)
T
- data typelist
- source listfromIndex
- start indextoIndex
- end index
public static <T> java.util.ArrayList<T> asList(T... data)
T
- data typedata
- data
public static <T> java.util.ArrayList<T> asList(java.util.Iterator<T> data)
T
- data typedata
- data
public static <T> boolean addAll(java.util.Collection<T> collection, T... objects)
T
- objects typecollection
- list to fillobjects
- objects
public static <T> boolean addAllNonNull(java.util.Collection<T> collection, T... objects)
T
- objects typecollection
- list to fillobjects
- objects
public static <T> boolean addAll(java.util.Collection<T> collection, java.util.Collection<T> objects)
T
- objects typecollection
- list to fillobjects
- objects
public static <T> boolean addAllNonNull(java.util.Collection<T> collection, java.util.Collection<T> objects)
T
- objects typecollection
- list to fillobjects
- objects
public static <T> boolean removeAll(java.util.Collection<T> collection, T... objects)
T
- objects typecollection
- list to fillobjects
- objects
public static <T> java.util.ArrayList<T> copy(java.util.Collection<T> collection)
T
- list typecollection
- list to copy
public static <T extends java.lang.Cloneable> java.util.ArrayList<T> clone(java.util.Collection<T> collection)
T
- collection objects typecollection
- collection to clone
public static <T> java.util.ArrayList<T> copy(T... data)
T
- data typedata
- data
public static <T> java.util.ArrayList<T> cloneOrCopy(java.util.Collection<T> collection)
T
- collection objects typecollection
- collection to perform action for
public static <T> java.util.List<T> removeNulls(java.util.List<T> list)
T
- list typelist
- list to refactor
public static boolean areEqual(java.util.List list1, java.util.List list2)
list1
- first listlist2
- second list
public static <T> java.util.ArrayList<java.lang.String> toStringList(java.util.List<T> list, TextProvider<T> textProvider)
T
- elements typelist
- elements listtextProvider
- text provider
public static int[] toArray(java.util.List<java.lang.Integer> list)
list
- Integer list
public static <T> java.util.ArrayList<T> toList(T[] array)
T
- data typearray
- data array
public static <T> java.util.ArrayList<T> toList(java.util.Deque<T> deque)
T
- data typedeque
- data deque
public static <T> java.util.ArrayList<T> filter(java.util.Collection<T> collection, Filter<T> filter)
T
- elements typecollection
- collecton to filterfilter
- filter to process
public static <K,V> java.util.ArrayList<K> keysList(java.util.Map<K,V> map)
K
- key object typeV
- value object typemap
- map to process
public static <K,V> java.util.ArrayList<V> valuesList(java.util.Map<K,V> map)
K
- key object typeV
- value object typemap
- map to process
public static <K,V> java.util.ArrayList<V> valuesSummaryList(java.util.Map<K,java.util.List<V>> map)
K
- key object typeV
- value object typemap
- map to process
public static <T> java.util.List<T> fillList(int amount, IndexedSupplier<T> supplier)
T
- data typeamount
- amount of list elementssupplier
- data provider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |