List of utility methods to do Map Add
void | addOne(Map Increment a Map of K->Integer for a given key. if (map != null) { if (map.get(key) != null) { map.put(key, map.get(key) + 1); } else { map.put(key, 1l); |
void | addOne(Map given a map of ? Integer count = map.get(key);
if (count == null)
count = 0;
map.put(key, count + 1);
|
Map | addTo(Map Add a value to a map containing a list of values mapped to a key. List<T> tl = map.get(key);
tl.add(value);
map.put(key, tl);
return map;
|
void | addTo(Map Adds element to the value-collection of key in map .
C collection = map.get(key); if (collection == null) { try { collection = (C) collectionClass.newInstance(); } catch (Exception e) { e.printStackTrace(); map.put(key, collection); ... |
T | addToAnd(T target, Map... items) add To And for (Map item : items) ((List) target.get("$and")).add(item); return target; |
List | addToList(Map add To List List<Y> values; if (map.containsKey(key)) { values = map.get(key); values.add(value); } else { values = new ArrayList<Y>(); values.add(value); map.put(key, values); ... |
void | addToListMap(Map map, Object key, Object value) Add a value to a Map from keys to Set of values, creating the value list as needed. if (map == null) { throw new IllegalArgumentException("invalid map"); if (key == null) { throw new IllegalArgumentException("invalid map key"); List valuesList = (List) map.get(key); if (valuesList == null) { ... |
boolean | addToListMap(Map Populated a (key,value) pair in a map of lists. if (map == null) { return false; List<V> list = map.get(key); if (list == null) { list = new ArrayList<V>(); map.put(key, list); if (!list.contains(value)) { list.add(value); return true; return false; |
void | addToListMap(Map Adds another element to the Map: The list of strings is enlarged List<String> currentList; if (map.containsKey(key)) { currentList = map.get(key); } else { currentList = new ArrayList<String>(); currentList.add(value); map.put(key, currentList); ... |
Map | addToListMap(Map add To List Map if (map == null) return null; if (key == null || value == null) return map; List<T> set = map.get(key); if (set == null) set = new ArrayList<T>(); set.add(value); ... |