net.sourceforge.jaulp.collections
Class MapUtils

java.lang.Object
  extended by net.sourceforge.jaulp.collections.MapUtils

public class MapUtils
extends java.lang.Object

Utility class for the use of Map object.

Version:
1.0
Author:
Asterios Raptis

Constructor Summary
MapUtils()
           
 
Method Summary
static
<K,V> K
getKeyFromValue(java.util.Map<K,V> map, V value)
          Returns the first founded key from the given value or null if nothing is found.
static
<K,V> java.util.Collection<K>
getKeysFromValue(java.util.Map<K,V> map, V value)
          Returns a Collection from all founded keys from the given value or null if nothing found.
static
<K,V> void
printMap(java.util.Map<K,V> msg)
          The Method printMap prints the HashMap to the console.
static
<T> java.util.Map<T,T>
toGenericMap(T[][] twoDimArray)
          Converts a two dimensional Array to a Map.
static java.util.Map<java.lang.String,java.lang.String> toMap(java.lang.String[][] twoDimArray)
          Converts a two dimensional String Array to a Map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapUtils

public MapUtils()
Method Detail

getKeyFromValue

public static <K,V> K getKeyFromValue(java.util.Map<K,V> map,
                                      V value)
Returns the first founded key from the given value or null if nothing is found.

Parameters:
map - The Map.
value - The value.
Returns:
Returns the first key from the given value or null if nothing found.

getKeysFromValue

public static <K,V> java.util.Collection<K> getKeysFromValue(java.util.Map<K,V> map,
                                                             V value)
Returns a Collection from all founded keys from the given value or null if nothing found.

Parameters:
map - The Map.
value - The value.
Returns:
Returns the key from the given value or an empty Collection if nothing found.

printMap

public static <K,V> void printMap(java.util.Map<K,V> msg)
The Method printMap prints the HashMap to the console.

Parameters:
msg - The map to print.

toGenericMap

public static <T> java.util.Map<T,T> toGenericMap(T[][] twoDimArray)
Converts a two dimensional Array to a Map.

Parameters:
twoDimArray - The two dimensional Array.
Returns:
The map produced from the two dimensional Array.

toMap

public static java.util.Map<java.lang.String,java.lang.String> toMap(java.lang.String[][] twoDimArray)
Converts a two dimensional String Array to a Map.

Parameters:
twoDimArray - The two dimensional String Array.
Returns:
The map produced from the two dimensional String Array.


Copyright © 2010. All Rights Reserved.