Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
- Set: no duplicates. HashSet: no order. TreeSet: sorted.
Exam weight Low
Exam weight
High
- TreeSet implements SortedSet: elements kept in ascending order; first(), last(), headSet, tailSet.
🎯 How this can come up · 1 question
MCQ
Which set keeps its elements in sorted order?
Correct: TreeSet.
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight
High
- HashSet: fast add/contains/remove by hashing, no ordering, duplicates ignored.
🎯 How this can come up · 1 question
MCQ
Adding "a" twice to a HashSet<String> gives a size of:
Correct: 1.
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight
High
- HashMap: key → value lookups; put, get, containsKey, remove, keySet; keys unique.
🎯 How this can come up · 1 question
MCQ
map.put("x", 1); map.put("x", 2); map.get("x") returns:
The second put replaces the value.
Exam weight Low
Exam weight Low
Exam weight Low
Exam weight
High
- TreeMap: like HashMap but keys are kept sorted; HashMap has no order.
Memory trickHash = fast, no order. Tree = sorted.
Exam weight Low
Exam weight Low
Exam weight Low
No slides match this filter.