com.ebay.carad.os.vitalsigns.util
Class CollectionUtil

java.lang.Object
  extended by com.ebay.carad.os.vitalsigns.util.CollectionUtil

public final class CollectionUtil
extends java.lang.Object

Utility class for manipulating collections.

Version:
$Id$
Author:
Jeremy Kraybill, Jeremy Thomerson

Nested Class Summary
static class CollectionUtil.SetComparator
           
private static class CollectionUtil.UnmodifiableMultiMap
           
 
Field Summary
static org.apache.commons.collections.Transformer TO_INTEGER_TRANSFORM
          Transformer to convert objects' string representations to integers.
 
Constructor Summary
private CollectionUtil()
           
 
Method Summary
static int compareSets(java.util.Collection set1, java.util.Collection set2)
           
static int compareSets(java.util.Collection set1, java.util.Collection set2, java.util.Comparator comparator)
           
static java.util.Map convertKeysToIntegers(java.util.Map inMap)
          Converts the keys of a map to integers and creates a new map with these new keys and the original values.
static java.util.List listOfLists(int containedLists)
          Returns a list contain N lists.
static void sortMultiMapLists(org.apache.commons.collections.MultiHashMap map, java.util.Comparator comparator)
           
static java.lang.String toString(java.util.Collection coll)
          Concatinates the elements of the collection into a single string.
static org.apache.commons.collections.MultiMap unmodifiableMultiMap(org.apache.commons.collections.MultiMap map)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TO_INTEGER_TRANSFORM

public static final org.apache.commons.collections.Transformer TO_INTEGER_TRANSFORM
Transformer to convert objects' string representations to integers.

Constructor Detail

CollectionUtil

private CollectionUtil()
Method Detail

listOfLists

public static java.util.List listOfLists(int containedLists)
Returns a list contain N lists.

Parameters:
containedLists - number of lists to contain.
Returns:
The list that contains containedLists lists.

convertKeysToIntegers

public static java.util.Map convertKeysToIntegers(java.util.Map inMap)
Converts the keys of a map to integers and creates a new map with these new keys and the original values.

Parameters:
inMap -
Returns:
Non-null

sortMultiMapLists

public static void sortMultiMapLists(org.apache.commons.collections.MultiHashMap map,
                                     java.util.Comparator comparator)

unmodifiableMultiMap

public static org.apache.commons.collections.MultiMap unmodifiableMultiMap(org.apache.commons.collections.MultiMap map)

toString

public static java.lang.String toString(java.util.Collection coll)
Concatinates the elements of the collection into a single string. Uses each element's "toString" method, and adds a ", " between elements. This method is mostly intended for use in debug or error messaging where a the collection of items is relevent information.

Parameters:
coll - Non-null collection of Non-null elements

compareSets

public static int compareSets(java.util.Collection set1,
                              java.util.Collection set2)

compareSets

public static int compareSets(java.util.Collection set1,
                              java.util.Collection set2,
                              java.util.Comparator comparator)


Copyright © 2004-2009. All Rights Reserved.