|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bristle.javalib.util.MapUtil
public class MapUtil
This class contains utility routines for creating and manipulating Java Maps.
Usage:
- The typical scenario for using this class is:
Map map = MapUtil.createMap(arr1, arr2);
- See the source code of the inner Tester class for more examples.
Assumptions:
Effects:
- None.
Anticipated Changes:
Notes:
Implementation Notes:
Portability Issues:
Revision History:
$Log$
| Nested Class Summary | |
|---|---|
static class |
MapUtil.DifferentNumberOfKeysAndValues
This exception is thrown when the number of specified keys is not the same as the number of specified values. |
static class |
MapUtil.Tester
Each class contains a Tester inner class with a main() for easier unit testing. |
| Constructor Summary | |
|---|---|
MapUtil()
|
|
| Method Summary | |
|---|---|
static Map |
createMap(Enumeration enumeration)
Create a Map from the specified Enumeration, using Integer values 0, 1, 2, and so on as the key values. |
static Map |
createMap(Enumeration enumKeys,
Enumeration enumVals)
Create a Map from the specified Enumerations of keys and values. |
static Map |
createMap(Iterator iter)
Create a Map from the specified Iterator, using Integer values 0, 1, 2, and so on as the key values. |
static Map |
createMap(Iterator iterKeys,
Iterator iterVals)
Create a Map from the specified Iterators of keys and values. |
static Map |
createMap(List list)
Create a Map from the specified List, using Integer values 0, 1, 2, and so on as the key values. |
static Map |
createMap(List listKeys,
List listVals)
Create a Map from the specified Lists of keys and values. |
static Map |
createMap(Object[] arr)
Create a Map from the specified array, using Integer values 0, 1, 2, and so on as the key values. |
static Map |
createMap(Object[] arrKeys,
Object[] arrVals)
Create a Map from the specified arrays of keys and values. |
static String |
mapToString(Map map)
Return a string version of the Map. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MapUtil()
| Method Detail |
|---|
public static String mapToString(Map map)
map - Map to convert to a String.
public static Map createMap(Iterator iter)
iter - Iterator of Objects to put in the Map.
public static Map createMap(Enumeration enumeration)
enumeration - Enumeration of Objects to put in the Map.
public static Map createMap(List list)
list - List of Objects to put in the Map.
public static Map createMap(Object[] arr)
arr - Array of Objects to put in the Map.
public static Map createMap(Iterator iterKeys,
Iterator iterVals)
throws MapUtil.DifferentNumberOfKeysAndValues
iterKeys - Iterator of Objects to use as keys in the Map.iterVals - Iterator of Objects to use as values in the Map.
MapUtil.DifferentNumberOfKeysAndValues - When the Iterators do not contain the same number of
elements.
public static Map createMap(Enumeration enumKeys,
Enumeration enumVals)
throws MapUtil.DifferentNumberOfKeysAndValues
enumKeys - Enumeration of Objects to use as keys in the Map.enumVals - Enumeration of Objects to use as values in the Map.
MapUtil.DifferentNumberOfKeysAndValues - When the Enumerations are not the same size.
public static Map createMap(List listKeys,
List listVals)
throws MapUtil.DifferentNumberOfKeysAndValues
listKeys - List of Objects to use as keys in the Map.listVals - List of Objects to use as values in the Map.
MapUtil.DifferentNumberOfKeysAndValues - When the Lists are not the same size.
public static Map createMap(Object[] arrKeys,
Object[] arrVals)
throws MapUtil.DifferentNumberOfKeysAndValues
arrKeys - Array of Objects to use as keys in the Map.arrVals - Array of Objects to use as values in the Map.
MapUtil.DifferentNumberOfKeysAndValues - When the arrays are not the same size.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||