Simple Java LinkedHashMap : LinkedHashMap « Collections Data Structure « Java






Simple Java LinkedHashMap


import java.util.LinkedHashMap;

public class Main {
  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));

    // retrieve value using Object get(Object key) method of Java LinkedHashMap class

    Object obj = lHashMap.get("One");
    System.out.println(obj);
  }
}

 








Related examples in the same category

1.Check if a particular key exists in Java LinkedHashMap example
2.Check if a particular value exists in Java LinkedHashMap example
3.Get Set view of Keys from Java LinkedHashMap
4.Get Size of Java LinkedHashMap
5.Iterate through the values of Java LinkedHashMap
6.Remove all values from Java LinkedHashMap
7.Remove value from Java LinkedHashMap
8.Check if a particular element exists in Java LinkedHashSet
9.Copy all elements of Java LinkedHashSet to an Object Array
10.Implementing a Least-Recently-Used (LRU) Cache