Practice Collections in Java
Work with Java Collections Framework including List, Set, Map, and Queue.
Work through 22 exercises with starter code, expected output, test cases, and hints.
Collections exercises
- ArrayList Basics Java exercise — Create and use ArrayList
- HashSet Basics Java exercise — Use HashSet for unique elements
- HashMap Basics Java exercise — Store key-value pairs
- List Iteration Methods Java exercise — Different ways to iterate a list
- Queue Operations Java exercise — Use Queue for FIFO operations
- Stack Operations Java exercise — Use Stack for LIFO operations
- Word Frequency Counter Java exercise — Count word frequencies in a sentence
- Remove Duplicates from List Java exercise — Remove duplicates while preserving order
- List Intersection Java exercise — Find common elements between two lists
- Sort Map by Value Java exercise — Sort a map by its values
- Group By Property Java exercise — Group elements by a property
- Simple LRU Cache Java exercise — Implement a simple LRU cache
- Priority Queue with Custom Order Java exercise — Use PriorityQueue with custom comparator
- Two Sum with HashMap Java exercise — Find pair with target sum using HashMap
- First Unique Element Java exercise — Find first element that appears once
- Merge K Sorted Lists Java exercise — Merge multiple sorted lists into one
- Stack Using Queues Java exercise — Implement a stack using only queues
- Group Anagrams Java exercise — Group words that are anagrams of each other
- Sliding Window Maximum Java exercise — Find maximum in each sliding window
- Top K Frequent Elements Java exercise — Find the k most frequent elements
- Merge Intervals Java exercise — Merge overlapping intervals
- Task Scheduler Java exercise — Find minimum time to complete all tasks with cooldown
Browse the complete Java practice path · Open the online Java compiler