Quick interview answer
HashMap = no order, O(1) average; LinkedHashMap = insertion (or access) order; TreeMap = sorted by key, O(log n), backed by a red-black tree.
Detailed explanation
HashMap allows one null key, TreeMap allows none (it must compare keys). Use LinkedHashMap when report ordering matters, TreeMap when you need range queries or sorted output.
java
1Map<String, Integer> counts = new HashMap<>();2for (char c : "automation".toCharArray()) {3 counts.merge(String.valueOf(c), 1, Integer::sum);4}5// sorted view6Map<String, Integer> sorted = new TreeMap<>(counts);Real-world example
Building a character-frequency report from test logs in a deterministic order.
Interview tip
Add the null-key nuance; it separates memorised answers from real understanding.