Clear the map
suggest changeMap<Integer, String> map = new HashMap<>(); map.put(1, "First element."); map.put(2, "Second element."); map.put(3, "Third element."); map.clear(); System.out.println(map.size()); // => 0
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents