Remove all values from Java LinkedHashMap - Java Collection Framework

Java examples for Collection Framework:LinkedHashMap

Description

Remove all values from Java LinkedHashMap

Demo Code


import java.util.LinkedHashMap;
 
public class Main {
 
  public static void main(String[] args) {
    LinkedHashMap lHashMap = new LinkedHashMap();
   /*ww w. j  a  va2  s . c  o m*/
    lHashMap.put("1","One");
    lHashMap.put("2","Two");
    lHashMap.put("3","Three");
 
    lHashMap.clear();
   
    System.out.println("Total key value pairs in LinkedHashMap are : "
                                                        + lHashMap.size());
  }
}
 

Result


Related Tutorials