0% found this document useful (0 votes)
15 views1 page

Collection Implementation Classes Java

Uploaded by

charanmekala17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Collection Implementation Classes Java

Uploaded by

charanmekala17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Collection Implementation Classes in Java

1. List Implementations
- ArrayList: Dynamic array, fast for reading, slow for insert/delete in middle.
- LinkedList: Doubly linked list, good for frequent insertions/deletions.
- Vector: Synchronized version of ArrayList (legacy class).
- Stack: Subclass of Vector. Implements LIFO (Last-In-First-Out) stack.

2. Set Implementations
- HashSet: Uses a hash table, no order is guaranteed.
- LinkedHashSet: Maintains insertion order using a linked list.
- TreeSet: Stores elements in sorted order using a Red-Black tree.

3. Queue/Deque Implementations
- PriorityQueue: Elements are ordered based on natural order or a comparator.
- ArrayDeque: Resizable array-based double-ended queue.
- LinkedList: Also implements Queue and Deque interfaces.

4. Map Implementations
- HashMap: Most commonly used, no ordering of keys.
- LinkedHashMap: Maintains insertion order of keys.
- TreeMap: Maintains sorted order of keys.
- Hashtable: Thread-safe version of HashMap (legacy class).
- WeakHashMap: Keys can be garbage collected if not referenced elsewhere.

5. Legacy Classes
- Vector: Synchronized dynamic array.
- Hashtable: Synchronized hash table for key-value pairs.
- Stack: LIFO stack (extends Vector).
- Enumeration: Legacy interface used to iterate over legacy collections.

You might also like