|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jtheque.utils.collections.CollectionUtils
public final class CollectionUtils
Provide some utilities operations on collections.
Method Summary | ||
---|---|---|
static
|
copyOf(Collection<T> list)
Return a copy of the list. |
|
static
|
emptyList()
Return an empty list. |
|
static
|
expand(Collection<S> collection,
Expander<S,T> expander)
Return a collection expanded. |
|
static
|
filter(Collection<T> collection,
Filter<T> filter)
Filter a collection with a filter. |
|
static
|
first(Iterable<T> collection)
Return the first element of the collection. |
|
static
|
forAllDo(Iterable<T> collection,
Closure<T> closure)
Perform a closure on all the objects of the collection. |
|
static
|
goToFirst(ListIterator<T> iterator)
Move the iterator to the first element. |
|
static
|
goToLast(Iterator<T> iterator)
Move the iterator to the last element. |
|
static void |
reverse(List<?> list)
Reverse a list. |
|
static
|
reverse(Map<T,K> map)
Reverse the order of a map. |
|
static
|
sort(List<T> list,
Comparator<T> comparator)
Sort a list. |
|
static
|
toCollection(Enumeration<T> enumeration)
Convert the enumeration to a collection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> void forAllDo(Iterable<T> collection, Closure<T> closure)
collection
- The collection of the objects.closure
- The closure.public static <T> List<T> copyOf(Collection<T> list)
T
- The type contained in the list.list
- The List to copy.
public static <S,T> Collection<T> expand(Collection<S> collection, Expander<S,T> expander)
T
- The type of object in the collection.collection
- The collection to expand.expander
- The expander object.
public static <T> void filter(Collection<T> collection, Filter<T> filter)
T
- The type of object in the collection.collection
- The collection to filter.filter
- The filter.public static <T,K> void reverse(Map<T,K> map)
T
- The Key type.K
- The value type.map
- The map to reverse.public static void reverse(List<?> list)
list
- The list to reverse.public static <T> void sort(List<T> list, Comparator<T> comparator)
T
- The type of object in the collection.list
- The list to sort.comparator
- The comparator to use to sort the list.public static <T> List<T> emptyList()
T
- The Type of object to store in the list.
public static <T> void goToFirst(ListIterator<T> iterator)
T
- The type of object stored in the iterator.iterator
- The list iterator.public static <T> void goToLast(Iterator<T> iterator)
T
- The type of object stored in the iterator.iterator
- The iterator.public static <T> Collection<T> toCollection(Enumeration<T> enumeration)
T
- The type of object stored in the enumeration.enumeration
- The enumeration to convert to Collection.
public static <T> T first(Iterable<T> collection)
T
- The objects stored in the collection.collection
- The collection.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |