pl.edu.agh.cast.util
Class CollectionUtil
java.lang.Object
pl.edu.agh.cast.util.CollectionUtil
public class CollectionUtil
- extends Object
Utility methods for operating on collections.
- Author:
- AGH CAST Team
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CollectionUtil
public CollectionUtil()
convertToCollection
public static <T> Collection<T> convertToCollection(Iterable<T> iterable)
- Converts given instance of
Iterable
to an instance of Collection
. If the iterable
is
also an instance of Collection
the same object is returned, otherwise new collection instance is created
and initialized with the values from the iterable
.
- Type Parameters:
T
- generic type of the Iterable
- Parameters:
iterable
- Iterable
to be converted to Collection
- Returns:
- if the
iterable
is an instance of collection then iterable
is returned,
otherwise a new initialized collection is returned
createList
public static <T> List<T> createList(T... elements)
- Creates a new list containing all of the given elements.
- Type Parameters:
T
- the type of elements in the list- Parameters:
elements
- elements
- Returns:
- a new list instance containing all of the given elements
Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.