Java Collection Programming Questions
List-Based Questions
1. Remove duplicates from an ArrayList
2. Reverse an ArrayList without using reverse()
3. Find frequency of each element in a list
4. Sort an ArrayList of strings alphabetically
5. Sort a list of custom objects (e.g. Employee by salary)
Set-Based Questions
6. Check if two sets have any common elements
7. Remove duplicate characters from a string using Set
8. Find union and intersection of two sets
Map-Based Questions
9. Count frequency of characters in a string using HashMap
10. Find the first non-repeating character using LinkedHashMap
11. Group words by their first letter using Map
12. Sort a HashMap by values
13. Find the word with the highest frequency in a sentence
Comparator/Comparable Questions
14. Sort a list of students by name using Comparable
15. Sort by marks descending using Comparator
16. Sort by multiple fields (name, then marks)
Queue/Stack/Deque Questions
17. Use Queue to implement a basic task scheduler
18. Check for balanced parentheses using Stack
19. Reverse a queue using stack
20. Implement LRU cache using LinkedHashMap
Bonus Challenges
21. Find duplicates in a list without using Set
22. Find the second highest number in a list
23. Convert Map to List and vice versa
24. Convert List to Set and vice versa
25. Get all keys/values from a Map and print them