org.carrot2.util
Class MapUtils

java.lang.Object
  extended by org.carrot2.util.MapUtils

public class MapUtils
extends Object

Utilities for working with Maps.


Method Summary
static
<K,V> HashMap<K,V>
asHashMap(Map<K,V> map)
           
static
<K> Integer
increment(Map<K,Integer> map, K key)
           
static
<K> Integer
increment(Map<K,Integer> map, K key, int value)
           
static Map<String,Object> unpack(Map map)
          Iterates through entries of the input map and for values being String arrays puts the first element of the map in the result map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

asHashMap

public static <K,V> HashMap<K,V> asHashMap(Map<K,V> map)

unpack

public static Map<String,Object> unpack(Map map)
Iterates through entries of the input map and for values being String arrays puts the first element of the map in the result map. Scalar values get copied to the output map unchanged.

This method might be useful for "unpacking" values from servlet HTTP requests.


increment

public static <K> Integer increment(Map<K,Integer> map,
                                    K key)

increment

public static <K> Integer increment(Map<K,Integer> map,
                                    K key,
                                    int value)


Copyright (c) Dawid Weiss, Stanislaw Osinski