org.broadleafcommerce.common.util
Class BLCMapUtils
java.lang.Object
org.broadleafcommerce.common.util.BLCMapUtils
public class BLCMapUtils
- extends Object
Convenience methods for interacting with maps
- Author:
- Andre Azzolini (apazzolini)
|
Method Summary |
static
|
keyedListMap(CV values,
TypedClosure<K,V> closure)
Given a collection of values and a TypedClosure that maps an appropriate key for a given value,
returns a HashMap of the key to a list of values that map to that key. |
static
|
keyedMap(CV values,
TypedClosure<K,V> closure)
Given a collection of values and a TypedClosure that maps an appropriate key for a given value,
returns a HashMap of the key to the value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BLCMapUtils
public BLCMapUtils()
keyedMap
public static <K,CV extends Iterable<V>,V> Map<K,V> keyedMap(CV values,
TypedClosure<K,V> closure)
- Given a collection of values and a TypedClosure that maps an appropriate key for a given value,
returns a HashMap of the key to the value.
Note: If two values share the same key, the later one will override the previous one in the returned map
- Parameters:
values - closure -
- Returns:
- the map
- See Also:
List --> Map
keyedListMap
public static <K,CV extends Iterable<V>,V> Map<K,List<V>> keyedListMap(CV values,
TypedClosure<K,V> closure)
- Given a collection of values and a TypedClosure that maps an appropriate key for a given value,
returns a HashMap of the key to a list of values that map to that key.
- Parameters:
values - closure -
- Returns:
- the map
- See Also:
List --> Map>
Copyright © 2013. All Rights Reserved.