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();
   /*from ww w. j  a  v  a  2  s  . c om*/
    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