at.tuwien.ifs.somtoolbox.util
Class CollectionUtils

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.util.CollectionUtils

public class CollectionUtils
extends Object

Utility methods related to collections.

Version:
$Id: CollectionUtils.java 4169 2011-02-13 22:48:16Z mayer $
Author:
Rudolf Mayer

Constructor Summary
CollectionUtils()
           
 
Method Summary
static HashMap<String,Integer> getOrCreateValue(HashMap<Integer,HashMap<String,Integer>> map, Integer key)
           
static HashSet<String> getOrCreateValue(Map<String,HashSet<String>> map, String key)
           
static ArrayList<String>[] getUniqueElements(Collection<? extends String> list1, Collection<? extends String> list2)
          Returns two ArrayLists, containing the elements only present in the first and second argument, respectively.
static ArrayList<String>[] getUniqueElements(String[] array1, String[] array2)
           
static int indexOf(ArrayList<String> list, String value)
           
static
<E> ArrayList<E>
toList(E... contents)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionUtils

public CollectionUtils()
Method Detail

getUniqueElements

public static ArrayList<String>[] getUniqueElements(Collection<? extends String> list1,
                                                    Collection<? extends String> list2)
Returns two ArrayLists, containing the elements only present in the first and second argument, respectively.


getUniqueElements

public static ArrayList<String>[] getUniqueElements(String[] array1,
                                                    String[] array2)

getOrCreateValue

public static HashSet<String> getOrCreateValue(Map<String,HashSet<String>> map,
                                               String key)

getOrCreateValue

public static HashMap<String,Integer> getOrCreateValue(HashMap<Integer,HashMap<String,Integer>> map,
                                                       Integer key)

indexOf

public static int indexOf(ArrayList<String> list,
                          String value)

toList

public static <E> ArrayList<E> toList(E... contents)