Java_Collections_Framework_Notes
Java_Collections_Framework_Notes
Iterable
Collection
/ | \
^ ^ ^
SortedSet
NavigableSet
Map
/ \
HashMap SortedMap
TreeMap
Example:
List<String> list = new ArrayList<>();
list.add("Apple"); list.add("Banana");
Set: No duplicates
set.add("Dog"); set.add("Cat");
Queue: FIFO
queue.add("A"); queue.add("B");
3. LinkedList Example:
list.add("One"); list.add("Two");
4. LinkedList Methods:
5. HashMap Example:
map.put(1, "One");
6. HashMap Methods:
9. Set vs Map:
stack.push(10); stack.pop();
queue.add("A"); queue.poll();
ts.add(3); ts.add(1);
ht.put("India", "Delhi");
End of Notes.