Java EE 5 SDK

com.sun.appserv.management.util.misc
Class MapUtil

java.lang.Object
  extended by com.sun.appserv.management.util.misc.MapUtil

public final class MapUtil
extends Object


Method Summary
static Object[] getKeyObjects(Map<?,?> m)
           
static String[] getKeyStrings(Map<?,?> m)
           
static
<K> Set<K>
getNullValueKeys(Map<K,?> m)
           
static
<K,V> V
getWithDefault(Map<K,V> m, K key, V defaultValue)
           
static boolean isAllStrings(Map<?,?> m)
           
static boolean mapsEqual(Map<?,?> m1, Map<?,?> m2)
           
static
<K,V> Map<K,V>
newMap(Map<K,V> m1, Map<K,V> m2)
          Create a new Map consisting of a single key/value pair.
static Map<String,String> newMap(String[] mappings)
          Create a new Map and insert the specified mappings as found in 'mappings'.
static
<V> Map<String,V>
newMap(String key, V value)
          Create a new Map consisting of a single key/value pair.
static
<T> Map<T,T>
newMap(T[] mappings)
          Create a new Map and insert the specified mappings as found in 'mappings'.
static
<K,V> Map<K,V>
newMapNoNullValues(Map<K,V> m)
           
static
<K> void
removeAll(Map<K,?> m, Set<K> s)
           
static
<T> void
removeAll(Map<T,?> m, T[] keys)
          Remove all entries keyed by 'keys'
static
<K,V> Map<K,V>
toMap(Properties props, Class<K> kClass, Class<V> vClass)
           
static String toString(Map<?,?> m)
           
static String toString(Map<?,?> m, String separator)
           
static Map<String,String> toStringStringMap(Map<?,?> m)
          Convert an arbitrary Map to one whose keys and values are both of type String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getWithDefault

public static <K,V> V getWithDefault(Map<K,V> m,
                                     K key,
                                     V defaultValue)

getKeyObjects

public static Object[] getKeyObjects(Map<?,?> m)

getKeyStrings

public static String[] getKeyStrings(Map<?,?> m)

newMap

public static <V> Map<String,V> newMap(String key,
                                       V value)
Create a new Map consisting of a single key/value pair.


newMap

public static <K,V> Map<K,V> newMap(Map<K,V> m1,
                                    Map<K,V> m2)
Create a new Map consisting of a single key/value pair.


newMap

public static <T> Map<T,T> newMap(T[] mappings)
Create a new Map and insert the specified mappings as found in 'mappings'. The even-numbered entries are the keys, and the odd-numbered entries are the values.


newMap

public static Map<String,String> newMap(String[] mappings)
Create a new Map and insert the specified mappings as found in 'mappings'. The even-numbered entries are the keys, and the odd-numbered entries are the values.


removeAll

public static <T> void removeAll(Map<T,?> m,
                                 T[] keys)
Remove all entries keyed by 'keys'


mapsEqual

public static boolean mapsEqual(Map<?,?> m1,
                                Map<?,?> m2)

newMapNoNullValues

public static <K,V> Map<K,V> newMapNoNullValues(Map<K,V> m)

toString

public static String toString(Map<?,?> m)

toString

public static String toString(Map<?,?> m,
                              String separator)

getNullValueKeys

public static <K> Set<K> getNullValueKeys(Map<K,?> m)

toMap

public static <K,V> Map<K,V> toMap(Properties props,
                                   Class<K> kClass,
                                   Class<V> vClass)

removeAll

public static <K> void removeAll(Map<K,?> m,
                                 Set<K> s)

isAllStrings

public static boolean isAllStrings(Map<?,?> m)
Returns:
true if non-null Map and all keys and values are of type java.lang.String

toStringStringMap

public static Map<String,String> toStringStringMap(Map<?,?> m)
Convert an arbitrary Map to one whose keys and values are both of type String.


Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.