# Java Collections Framework ## Kya Hai? Pre-built data structures aur algorithms ka set jo common programming tasks simplify karta hai. ## Hierarchy ``` Collection (Interface) ├── List (Interface) — Ordered, Duplicates allowed │ ├── ArrayList │ ├── LinkedList │ ├── Vector │ └── Stack │ ├── Set (Interface) — No duplicates │ ├── HashSet │ ├── LinkedHashSet │ └── TreeSet │ └── Queue (Interface) — FIFO ├── PriorityQueue ├── Deque └── ArrayDeque Map (Interface) — Key-Value pairs ├── HashMap ├── LinkedHashMap ├── TreeMap └── Hashtable ``` ## import karna ```java import java.util.*; // Sab ek saath // Ya specific: import java.util.ArrayList; import java.util.HashMap; ``` ## Kab Kya Use Karein? | Need | Use | |------|-----| | Ordered list, index access | ArrayList | | Frequent insert/delete | LinkedList | | Unique elements | HashSet | | Unique + sorted | TreeSet | | Key-Value store | HashMap | | Key-Value + sorted | TreeMap | | Priority based processing | PriorityQueue |