List of usage examples for java.util HashMap put
public V put(K key, V value)
From source file:Main.java
public static HashMap<String, String> getDensity(Context cxt) { DisplayMetrics displayMetrics = cxt.getResources().getDisplayMetrics(); StringBuilder builder = new StringBuilder(); HashMap<String, String> map = new HashMap<String, String>(); map.put("Density", displayMetrics.density + ""); map.put("densityDpi", displayMetrics.densityDpi + ""); map.put("heightPixels", displayMetrics.heightPixels + ""); map.put("widthPixels", displayMetrics.widthPixels + ""); return map;/* w w w .j a v a 2 s. co m*/ }
From source file:Main.java
/** * This function returns a hashmap which contains the colors for each face of the cube *//* www . ja v a2 s . co m*/ public static HashMap<Character, Integer> getColorLetterHashMap(SharedPreferences sp) { HashMap<Character, Integer> hashMap = new HashMap<>(7); hashMap.put('Y', Color.parseColor("#" + sp.getString("cubeDown", "FDD835"))); hashMap.put('R', Color.parseColor("#" + sp.getString("cubeRight", "EC0000"))); hashMap.put('G', Color.parseColor("#" + sp.getString("cubeFront", "02D040"))); hashMap.put('B', Color.parseColor("#" + sp.getString("cubeBack", "304FFE"))); hashMap.put('O', Color.parseColor("#" + sp.getString("cubeLeft", "FF8B24"))); hashMap.put('W', Color.parseColor("#" + sp.getString("cubeTop", "FFFFFF"))); hashMap.put('N', Color.parseColor("#9E9E9E")); return hashMap; }
From source file:Main.java
/** * @param key/*www .ja va 2s . co m*/ * @return */ protected static final HashMap<String, Object> paramsWithKey(final String key) { final HashMap<String, Object> params = new HashMap<String, Object>(); params.put("key", key); return params; }
From source file:Main.java
public static ArrayList<HashMap<String, Boolean>> getTodos() { ArrayList<HashMap<String, Boolean>> result = new ArrayList<HashMap<String, Boolean>>(); HashMap<String, Boolean> todo = new HashMap<String, Boolean>(); todo.put("TODO", false); result.add(todo);/*from ww w . j ava 2s . c o m*/ HashMap<String, Boolean> done = new HashMap<String, Boolean>(); todo.put("DONE", true); result.add(done); return result; }
From source file:Main.java
public static <K, V> HashMap<K, V> createHashMap(K k, V v) { HashMap<K, V> m = new HashMap<K, V>(); m.put(k, v); return m;// ww w. j a va 2 s . co m }
From source file:Main.java
public static <K, V> HashMap<K, V> createHashMap(K k1, V v1, K k2, V v2) { HashMap<K, V> m = new HashMap<K, V>(); m.put(k1, v1); m.put(k2, v2);// w w w. ja va2 s.co m return m; }
From source file:Main.java
/** * Interim method to get this code to compile against the 1.0-RC1 engine. * Creats a map with only one key, and the list supplied as the collection of * values for that key.//from w w w .j a va2 s.c om * @param key * @param list * @return */ public static Map getMapFromList(Object key, List list) { HashMap map = new HashMap(); for (Object value : list) { map.put(key, value); } return map; }
From source file:Main.java
public static HashMap<String, Integer> getMap() { HashMap<String, Integer> idDescriptionMap = new HashMap<String, Integer>(); idDescriptionMap.put("Play", 1); idDescriptionMap.put("Exit", 2); idDescriptionMap.put("Replay", 3); idDescriptionMap.put("Main Menu", 4); return idDescriptionMap; }
From source file:Main.java
public static <K, V> HashMap<K, V> createHashMap(K k1, V v1, K k2, V v2, K k3, V v3) { HashMap<K, V> m = new HashMap<K, V>(); m.put(k1, v1); m.put(k2, v2);/*from w w w .ja v a2s. com*/ m.put(k3, v3); return m; }
From source file:Main.java
public static <K, V> HashMap<K, V> createHashMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) { HashMap<K, V> m = new HashMap<K, V>(); m.put(k1, v1); m.put(k2, v2);/* w w w. j a v a 2 s .co m*/ m.put(k3, v3); m.put(k4, v4); return m; }