ecologylab.collections
Class CollectionTools

java.lang.Object
  extended by ecologylab.generic.Debug
      extended by ecologylab.collections.CollectionTools

public class CollectionTools
extends Debug

Convenience methods for creating and manipulating collections.

Author:
andruid

Constructor Summary
CollectionTools()
           
 
Method Summary
static
<T> java.util.HashMap<T,T>
buildHashMap(T[][] entries)
          Create a HashMap, and popuplate with entries from the passed in array of key value pairs.
static java.util.HashMap<java.lang.String,java.lang.String> buildHashMapFromLCStrings(java.lang.String[] strings)
          Create a HashMap, and populate with entries from the passed in array of Strings.
static java.util.HashMap<java.lang.String,java.lang.String> buildHashMapFromStrings(java.lang.String[] strings)
          Create a HashMap, and populate with entries from the passed in array of Strings.
static
<T> void
buildMap(java.util.Map<T,T> map, T[][] entries)
           
static void buildMapFromLCStrings(java.util.Map<java.lang.String,java.lang.String> map, java.lang.String[] strings)
          Populate a HashMap from the supplied array of Strings.
static void buildMapFromStrings(java.util.Map<java.lang.String,java.lang.String> map, java.lang.String[] strings)
          Populate a HashMap from the supplied array of Strings.
static java.util.HashMap buildNumberHashMapFromStrings(java.lang.String[] strings)
           
static void buildNumberMapFromStrings(java.util.Map<java.lang.String,java.lang.Integer> map, java.lang.String[] strings)
           
static void stringIntMapEntry(java.util.Map<java.lang.String,IntSlot> map, java.lang.String string, int integer)
           
 
Methods inherited from class ecologylab.generic.Debug
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollectionTools

public CollectionTools()
Method Detail

buildHashMapFromStrings

public static final java.util.HashMap<java.lang.String,java.lang.String> buildHashMapFromStrings(java.lang.String[] strings)
Create a HashMap, and populate with entries from the passed in array of Strings. The key and value will be the same for each entry.

Parameters:
strings -
Returns:

buildHashMapFromLCStrings

public static final java.util.HashMap<java.lang.String,java.lang.String> buildHashMapFromLCStrings(java.lang.String[] strings)
Create a HashMap, and populate with entries from the passed in array of Strings. But only use Strings that are lower case; other entries in the array are ignored. The key and value will be the same for each entry.

Parameters:
strings -
Returns:

buildHashMap

public static <T> java.util.HashMap<T,T> buildHashMap(T[][] entries)
Create a HashMap, and popuplate with entries from the passed in array of key value pairs.

Parameters:
entries -
Returns:

buildMapFromStrings

public static final void buildMapFromStrings(java.util.Map<java.lang.String,java.lang.String> map,
                                             java.lang.String[] strings)
Populate a HashMap from the supplied array of Strings. The key and value will be the same for each entry.

Parameters:
map -
strings -

buildMapFromLCStrings

public static final void buildMapFromLCStrings(java.util.Map<java.lang.String,java.lang.String> map,
                                               java.lang.String[] strings)
Populate a HashMap from the supplied array of Strings. But only use Strings that are lower case; other entries in the array are ignored. The key and value will be the same for each entry.

Parameters:
map -
strings -

buildMap

public static <T> void buildMap(java.util.Map<T,T> map,
                                T[][] entries)

buildNumberHashMapFromStrings

public static final java.util.HashMap buildNumberHashMapFromStrings(java.lang.String[] strings)

buildNumberMapFromStrings

public static final void buildNumberMapFromStrings(java.util.Map<java.lang.String,java.lang.Integer> map,
                                                   java.lang.String[] strings)

stringIntMapEntry

public static final void stringIntMapEntry(java.util.Map<java.lang.String,IntSlot> map,
                                           java.lang.String string,
                                           int integer)