Remove value from LinkedHashMap - Java Collection Framework

Java examples for Collection Framework:LinkedHashMap

Description

Remove value from LinkedHashMap

Demo Code

 
import java.util.LinkedHashMap;
 
public class Main {
 
  public static void main(String[] args) {
   // w w  w  . j a  va  2 s  . c o m
    //create LinkedHashMap object
    LinkedHashMap lHashMap = new LinkedHashMap();
   
    //add key value pairs to LinkedHashMap
    lHashMap.put("1","One");
    lHashMap.put("2","Two");
    lHashMap.put("3","Three");
   
    Object obj = lHashMap.remove("2");
    System.out.println(obj + " Removed from LinkedHashMap");
   
  }
}

Result


Related Tutorials