Govt Exams
HashMap allows one null key which is handled specially and stored at index 0. TreeMap does not allow null keys.
HashMap has an initial capacity of 16 and doubles its capacity when load factor (0.75) is reached.
No collection allows duplicate keys. When a duplicate key is added to a Map, it overwrites the previous value. HashSet and TreeSet don't allow duplicates.
Collections.unmodifiableList() returns a read-only view of the list. Any modification attempts throw UnsupportedOperationException.
The Comparable interface allows objects to define their natural ordering by implementing compareTo() method.
TreeSet implements SortedSet and maintains elements in sorted order with O(log n) operations. HashSet has O(1) average operations but no order guarantee.
The removeIf() method was introduced in Java 8 to remove elements based on a given Predicate condition.
LinkedList provides O(1) insertion at the beginning (head), while ArrayList requires O(n) time to shift elements. Both support nulls and LinkedList uses more memory due to node pointers.
descendingMap() method of NavigableMap returns a reverse-ordered view. reverseMap() doesn't exist in Collections Framework.
HashSet removes duplicates. The list [1,2,3,2,1] is converted to a set containing only unique elements {1,2,3}, so size is 3.