|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.hpi.fgis.dude.util.CollectionUtil
public class CollectionUtil
Convenience methods for collections.
Constructor Summary | |
---|---|
CollectionUtil()
|
Method Summary | ||
---|---|---|
static
|
asList(Iterator<T> iterator)
Materializes the elements of the given Iterator into a List . |
|
static
|
first(Iterable<T> iterable)
Returns the first element of the collection. |
|
static
|
first(List<T> list)
Returns the first element of the collection. |
|
static
|
last(Iterable<T> iterable)
Returns the last element of the collection. |
|
static
|
last(List<T> list)
Returns the last element of the collection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CollectionUtil()
Method Detail |
---|
public static <T> T last(List<T> list)
T
- the element typelist
- the collection
public static <T> T last(Iterable<T> iterable)
T
- the element typeiterable
- the collection
public static <T> T first(List<T> list)
T
- the element typelist
- the collection
public static <T> T first(Iterable<T> iterable)
T
- the element typeiterable
- the collection
public static <T> List<T> asList(Iterator<T> iterator)
Iterator
into a List
.
T
- the element typeiterator
- the Iterator
to materialize
List
containing the materialized elements.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |