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

Java Collections One Page

The document provides an overview of the Java Collections Framework, detailing various data structures like ArrayList, HashMap, HashSet, TreeMap, and LinkedHashMap, along with their time complexities for core operations. It also highlights the importance of correct implementations of equals() and hashCode() for HashMap and discusses concurrency support with ConcurrentHashMap and CopyOnWriteArrayList. Additionally, it mentions the preference of ArrayDeque over Stack for queue operations and the use of PriorityQueue for heap-based priority ordering.

Uploaded by

Tanuj Sharma
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)
5 views1 page

Java Collections One Page

The document provides an overview of the Java Collections Framework, detailing various data structures like ArrayList, HashMap, HashSet, TreeMap, and LinkedHashMap, along with their time complexities for core operations. It also highlights the importance of correct implementations of equals() and hashCode() for HashMap and discusses concurrency support with ConcurrentHashMap and CopyOnWriteArrayList. Additionally, it mentions the preference of ArrayDeque over Stack for queue operations and the use of PriorityQueue for heap-based priority ordering.

Uploaded by

Tanuj Sharma
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

Java Collections Framework

Java With DSA — One-Page Study Document

ArrayList
Dynamic array with O(1) average indexed access and amortized O(1) append. Insertions/removals in the middle are O(n).

HashMap
Hash-based key/value structure with expected O(1) get/put. Correct equals() and hashCode() implementations are essential.

HashSet
Stores unique elements using hashing. Expected O(1) add, contains and remove.

TreeMap / TreeSet
Sorted map/set implementations based on a balanced tree. Core operations are O(log n).

LinkedHashMap / LinkedHashSet
Preserve predictable encounter order. LinkedHashMap can also support access-order behavior useful for cache designs.

Queue / Deque
ArrayDeque is generally preferred over the legacy Stack class for stack or double-ended queue operations. PriorityQueue provides
heap-based priority ordering.

Concurrency
ConcurrentHashMap supports concurrent access. CopyOnWriteArrayList is useful when reads greatly outnumber writes.

You might also like