List of usage examples for java.util Map get
V get(Object key);
From source file:Main.java
public static void printDetails(Map<String, String> map) { String usage = map.get("CSS"); System.out.println("Map: " + map); System.out.println("Map Size: " + map.size()); System.out.println("Map is empty: " + map.isEmpty()); System.out.println("Map contains CSS key: " + map.containsKey("CSS")); System.out.println("Usage: " + usage); System.out.println("removed: " + map.remove("CSS")); }
From source file:WordCount.java
static void addWord(Map map, String word) { Object obj = map.get(word); if (obj == null) { map.put(word, ONE);/*w w w . java 2 s .c o m*/ } else { int i = ((Integer) obj).intValue() + 1; map.put(word, new Integer(i)); } }
From source file:Main.java
public static Object getKeyFromValue(Map hm, Object value) { for (Object o : hm.keySet()) { if (hm.get(o).equals(value)) { return o; }//from www.ja va 2 s. c o m } return null; }
From source file:Main.java
public static <K, V> V getOrElse(Map<K, V> m, K k, V def) { V v = m.get(k); if (v != null) return v; else/*from ww w .ja va 2s.c o m*/ return def; }
From source file:Main.java
public static String getInclude(Map<String, Object> param) { return (String) param.get("include"); }
From source file:Main.java
public static Object get(String attribute) { Map map = (Map) SESSION_MAP.get(); return map.get(attribute); }
From source file:Main.java
public static String getMapValueAsString(Map<String, Object> list, String key) { return list.get(key).toString(); }
From source file:Main.java
public static void addIntValue(Map map, Object key, int value) { Object o = map.get(key); if (o == null) map.put(key, new Integer(value)); else/* w w w . j a v a 2s .c o m*/ map.put(key, new Integer(((Integer) o).intValue() + value)); }
From source file:Main.java
public static <K, V> List<V> getValueList(Map<K, List<V>> map, K key) { List<V> valueList = map.get(key); if (valueList == null) return Collections.emptyList(); return valueList; }
From source file:Main.java
public static <K, V> Set<V> getValueSet(Map<K, Set<V>> map, K key) { Set<V> values = map.get(key); if (values == null) return Collections.emptySet(); return values; }