What happens if in the TreeMap request a value for a non-existent key. An exception will be thrown or null will be returned.

  • As in the usual hashmap returns null - Roman Danilov

1 answer 1

 TreeMap<String, String> map = new TreeMap<>(); System.out.println(map.get("Hello")); //На консоль выведит null