org.almendra.commons.util.collection
Class CollectionUtility

java.lang.Object
  extended by org.almendra.commons.util.collection.CollectionUtility

public class CollectionUtility
extends java.lang.Object

CollectionUtility provides several utility methods to deal with collentions not found in Collections or other classes of the Java collection framework.

Author:
Oliver Plohmann

Method Summary
static java.util.Set duplicates(java.util.List listOfLists)
          Answer all elements that appear in more than once the collections contained in listOfLists.
static java.util.List toList(java.util.Collection collection)
          Convert a Collection to a List.
static java.util.List toList(java.lang.Object object)
          Answer a List containing an object.
static java.util.Set toSet(java.util.Collection collection)
          Convert a Collection to a Set.
static java.lang.String[] toStringArray(java.util.Collection collection)
          Answer an array of strings containing all the strings of the collection argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

duplicates

public static java.util.Set duplicates(java.util.List listOfLists)
Answer all elements that appear in more than once the collections contained in listOfLists.

Parameters:
listOfLists - list that contains lists
Returns:
set of duplicate elements

toSet

public static java.util.Set toSet(java.util.Collection collection)
Convert a Collection to a Set.

Parameters:
collection - to be converted
Returns:

toList

public static java.util.List toList(java.util.Collection collection)
Convert a Collection to a List.

Parameters:
collection - to be converted
Returns:

toList

public static java.util.List toList(java.lang.Object object)
Answer a List containing an object.

Parameters:
object - to be contained in a list
Returns:
list with contained object

toStringArray

public static java.lang.String[] toStringArray(java.util.Collection collection)
Answer an array of strings containing all the strings of the collection argument.

Parameters:
collection - the argument collection containing strings
Returns:
an array of strings