Govt Exams
ConcurrentHashMap uses bucket-level locking (segment locking in Java 7, node-level in Java 8+) allowing concurrent reads/writes, making it thread-safe without synchronizing the entire map.
Collections.emptyList() returns an immutable, empty list. Option B also works but is more verbose. Option C creates mutable list, and Option D creates mutable list from array.
TreeSet uses comparator or natural ordering, which cannot handle null values, throwing NullPointerException during insertion.
peek() returns the head element without removing it. poll() removes and returns, remove() throws exception if empty, and pop() is not a PriorityQueue method.
Vector is a legacy synchronized collection, while ArrayList is unsynchronized but faster. For thread-safety with ArrayList, use Collections.synchronizedList().
TreeMap is based on Red-Black tree, so get(), put(), and remove() operations have O(log n) time complexity due to tree traversal.
Collections.frequency() correctly handles null values and returns the count of null elements in the collection.
lower() returns the greatest element < given element. floor() returns <= element.
Iterator.next() throws NoSuchElementException when hasNext() returns false and next() is called.
TreeSet maintains sorted order (O(log n) insertion/deletion) using a Red-Black tree structure.