Java Collections Handbook
Overview
The Java Collections Framework provides architecture to store and manipulate a group of objects. It includes interfaces
such as List, Set, Queue, and Map, and their various implementations.
List Interface
Common Implementations: ArrayList, LinkedList, Vector, Stack
Key Methods:
- add(E e), add(int index, E element), addAll(...)
- get(int index), set(int index, E element)
- remove(int index), remove(Object o)
- indexOf(), lastIndexOf(), subList(), toArray()
- isEmpty(), size(), clear(), contains()
Set Interface
Common Implementations: HashSet, LinkedHashSet, TreeSet
Key Methods:
- add(), remove(), contains(), clear(), size(), isEmpty()
- retainAll(), removeAll(), containsAll()
Queue Interface
Common Implementations: LinkedList, PriorityQueue
Key Methods:
- add(), offer(), remove(), poll(), peek(), element()
Deque Interface
Common Implementations: ArrayDeque, LinkedList
Key Methods:
- addFirst(), addLast(), removeFirst(), removeLast()
- peekFirst(), peekLast(), offerFirst(), offerLast()
- pollFirst(), pollLast(), push(), pop()
Map Interface
Common Implementations: HashMap, TreeMap, LinkedHashMap
Key Methods:
- put(), get(), remove(), putIfAbsent(), replace()
- containsKey(), containsValue(), clear(), isEmpty(), size()
- keySet(), values(), entrySet()