import java.util.HashMap; public class MapEx { public void doExample() { HashMap m = new HashMap<>(); System.out.println(m.isEmpty() + " " + m.toString()); System.out.println(m.put(5,"A") + " " + m.toString()); System.out.println(m.put(7,"B") + " " + m.toString()); System.out.println(m.put(2,"E") + " " + m.toString()); System.out.println(m.put(8,"A") + " " + m.toString()); System.out.println(m.put(2,"Q") + " " + m.toString()); System.out.println(m.get(7) + " " + m.toString()); System.out.println(m.get(4) + " " + m.toString()); System.out.println(m.remove(2) + " " + m.toString()); System.out.println(m.remove(5) + " " + m.toString()); System.out.println(m.isEmpty() + " " + m.toString()); System.out.println(m.entrySet() + " " + m.toString()); System.out.println(m.values() + " " + m.toString()); } public static void main(String[] args) { (new MapEx()).doExample(); } }