Get value from LinkedHashMap in Java

Description

The following code shows how to get value from LinkedHashMap.

Example


/*from   w ww.j a  va2  s  .  c o  m*/
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);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    Java Collection »




Java ArrayList
Java Collection
Java Comparable
Java Comparator
Java HashMap
Java HashSet
Java Iterator
Java LinkedHashMap
Java LinkedHashSet
Java LinkedList
Java List
Java ListIterator
Java Map
Queue
Java Set
Stack
Java TreeMap
TreeSet