Skip to main content
1:1 mock interviews with Sumit, scored on a real hiring rubric.Book a slot →

6 topics · 0/6 read

Java Collections Framework

The collections hierarchy, how HashMap works inside, ArrayList vs LinkedList, ConcurrentHashMap, Comparable vs Comparator, and fail-fast vs fail-safe iterators.

  1. Collections Hierarchy: List, Set, Queue and Map

    The Java Collections Framework gives you List, Set, Queue and Map with several implementations each. Choosing the right one by ordering, duplicates and time complexity is a basic Java interview skill.

    Read now
  2. How HashMap Works Internally

    How HashMap works internally is probably the most asked Java question. You should explain hashing to buckets, collisions, treeification in Java 8, the load factor and resizing, and why HashMap is not thread-safe.

    Read now
  3. ArrayList vs LinkedList

    ArrayList vs LinkedList is a favourite question because the textbook answer ("LinkedList is faster for inserts") is mostly wrong in practice. ArrayList wins almost every real workload because of memory locality.

    Read now
  4. ConcurrentHashMap and Thread-Safe Collections

    ConcurrentHashMap is the go-to map for shared state between threads. Interviewers ask how it stays thread-safe without locking the whole map, how it differs from Collections.synchronizedMap, and how to update values atom

    Read now
  5. Comparable vs Comparator and Sorting

    Comparable defines an object's natural order inside the class; Comparator defines any number of external orders. Sorting objects by several fields with Comparator chains is a common live-coding task.

    Read now
  6. Fail-Fast vs Fail-Safe Iterators

    Fail-fast iterators throw ConcurrentModificationException when a collection changes during iteration; fail-safe (weakly consistent) iterators work on a snapshot or tolerate changes. Interviewers ask how it works and how

    Read now