How to remove all the values from LinkedHashMap in Java

1 Answer

0 votes
package javaapplication1;

import java.util.LinkedHashMap;

public class JavaApplication1 {

    public static void main(String[] args) {

        LinkedHashMap lHashMap = new LinkedHashMap();
   
        // key value pairs
        lHashMap.put("1", "Java");
        lHashMap.put("2", "C#");
        lHashMap.put("3", "C++");
        lHashMap.put("4", "C");
        lHashMap.put("5", "PHP");

        lHashMap.clear();
   
        System.out.println(lHashMap);
  }
}
  
/*
run:

{}

*/

 



answered Sep 27, 2016 by avibootz

Related questions

1 answer 149 views
1 answer 209 views
2 answers 158 views
1 answer 184 views
1 answer 173 views
1 answer 174 views
...