List of usage examples for java.util LinkedHashMap put
V put(K key, V value);
From source file:Main.java
public static void main(String[] args) { LinkedHashMap<String, String> lHashMap = new LinkedHashMap<String, String>(); lHashMap.put("1", "One"); lHashMap.put("2", "Two"); lHashMap.put("3", "Three"); boolean blnExists = lHashMap.containsKey("3"); System.out.println(blnExists); }
From source file:Main.java
public static void main(String[] args) { LinkedHashMap<String, Integer> lHashMap = new LinkedHashMap<String, Integer>(); lHashMap.put("One", new Integer(1)); lHashMap.put("Two", new Integer(2)); Object obj = lHashMap.get("One"); System.out.println(obj);/* ww w .j ava 2 s. c o m*/ }
From source file:Main.java
public static void main(String[] args) { LinkedHashMap<String, String> lHashMap = new LinkedHashMap<String, String>(); lHashMap.put("1", "One"); lHashMap.put("2", "Two"); lHashMap.put("3", "Three"); boolean blnExists = lHashMap.containsValue("Two"); System.out.println(blnExists); }
From source file:Main.java
public static void main(String[] args) { LinkedHashMap<String, String> lHashMap = new LinkedHashMap<String, String>(); lHashMap.put("1", "One"); lHashMap.put("2", "Two"); lHashMap.put("3", "Three"); lHashMap.clear();/*from w ww .ja v a 2s . c om*/ System.out.println(lHashMap.size()); }
From source file:Main.java
public static void main(String[] args) { LinkedHashMap<String, String> lHashMap = new LinkedHashMap<String, String>(); lHashMap.put("1", "One"); lHashMap.put("2", "Two"); lHashMap.put("3", "Three"); Collection c = lHashMap.values(); Iterator itr = c.iterator();// w w w. j a v a 2s. c o m while (itr.hasNext()) { System.out.println(itr.next()); } }
From source file:Main.java
public static void main(String[] args) { LinkedHashMap<String, String> lHashMap = new LinkedHashMap<String, String>(); lHashMap.put("1", "One"); lHashMap.put("2", "Two"); lHashMap.put("3", "Three"); Set st = lHashMap.keySet();/*from w w w . j a va 2s .co m*/ Iterator itr = st.iterator(); while (itr.hasNext()) { System.out.println(itr.next()); } st.remove("2"); boolean blnExists = lHashMap.containsKey("2"); System.out.println(blnExists); }
From source file:MainClass.java
public static void main(String[] args) { LinkedHashMap linkedMap = new LinkedHashMap(); for (int i = 0; i < 10; i++) { linkedMap.put(i, i); }//from w w w . j a v a2 s . c o m System.out.println(linkedMap); // Least-recently used order: linkedMap = new LinkedHashMap(16, 0.75f, true); for (int i = 0; i < 10; i++) { linkedMap.put(i, i); } System.out.println(linkedMap); for (int i = 0; i < 7; i++) // Cause accesses: System.out.println(linkedMap.get(i)); System.out.println(linkedMap); }
From source file:Main.java
public static void main(String[] args) { LinkedHashMap<String, Integer> map = new LinkedHashMap<String, Integer>(); // add some values in the map map.put("One", 1); map.put("Two", 2); map.put("Three", 3); System.out.println(map);/* w w w .j a v a 2 s. c o m*/ // clear the map map.clear(); System.out.println(map); }
From source file:Main.java
public static void main(String[] args) { LinkedHashMap<String, Integer> map = new LinkedHashMap<String, Integer>(5); // add some values in the map map.put("One", 1); map.put("Two", 2); map.put("Three", 3); System.out.println(map);//from w w w . j av a 2s. c o m // clear the map map.clear(); System.out.println(map); }
From source file:Main.java
public static void main(String[] args) { LinkedHashMap<String, Integer> map = new LinkedHashMap<String, Integer>(5); // add some values in the map map.put("One", 1); map.put("Two", 2); map.put("Three", 3); System.out.println(map);//from www. j a v a2s . c o m // get key "Three" System.out.println(map.get("Three")); // get key "Five" System.out.println(map.get("Five")); }