- Published:
- Last updated:
Java Collections
- Authors
- Name
- Lucian Oprea
- @LucianDSA_
00:30:00
Filter by difficulty
40 of 40 questions shown
List
⏷ 1. Why are collections preferred over arrays in Java?
⏷ 2. What is the difference between ArrayList and LinkedList? When would you use each?
⏷ 3. How does the subList() method work in ArrayList?
⏷ 4. How does Vector ensure thread safety, and what are its drawbacks?
⏷ 5. What algorithm is used by these Java APIs Arrays.sort() and Collections.sort()?
Set
Free preview complete
You’ve reached the end of the free preview
Get every remaining question and complete answer, plus progress tracking across the full Interview Question Library.
- 35 more questions and complete answers in this topic
- Full access to every interview topic
- Progress tracking and question flags
- New questions and improvements during your subscription
Full access from
$12/month
No long-term commitment. Cancel whenever you want.
⏷ 6. How do HashMap and HashSet Work Internally?
⏷ 7. How does a HashSet ensure uniqueness of elements?
⏷ 8. If one needs a Set, how do you choose between HashSet vs. TreeSet?
⏷ 9. What is the difference between HashSet, LinkedHashSet, and TreeSet?
⏷ 10. How is iteration order maintained in LinkedHashSet?
⏷ 11. Can you store null values in a TreeSet? Why or why not?
⏷ 12. How does TreeSet maintain its sorting order?
Map
⏷ 13. Describe various implementations of the Map interface and their use case differences?
⏷ 14. How does LinkedHashMap maintain insertion order?
⏷ 15. What is the role of the load factor in HashMap?
⏷ 16. What is the difference between HashMap and Hashtable?
⏷ 17. Can you implement a LRU Cache using a LinkedHashMap?
⏷ 18. What is a WeakHashMap, and how does it handle garbage collection?
⏷ 19. How does ConcurrentHashMap achieve thread safety?
Queue and Deque
⏷ 20. What is the difference between Queue and Deque?
⏷ 21. How does a PriorityQueue determine element order?
⏷ 22. What are the use cases for ArrayDeque?
⏷ 23. How does a BlockingQueue handle producer-consumer scenarios?
⏷ 24. What is the difference between LinkedBlockingQueue and ArrayBlockingQueue?
Thread-safe Collections
⏷ 25. Describe and compare fail-fast and fail-safe iterators. Give examples.
⏷ 26. What is a Concurrent Collection?
⏷ 27. What is the difference between CopyOnWriteArrayList and ArrayList?
⏷ 28. How do thread-safe collections achieve thread safety?
⏷ 29. What are the trade-offs of using BlockingQueue in a multithreaded application?
Generics and Collections
⏷ 30. What is the benefit of Generics in Collections Framework in java?
Sorting and Comparators
⏷ 31. What is the difference between Comparable and Comparator? When would you use each?
⏷ 32. How do you sort a Map by its keys or values?
⏷ 33. What are the benefits of using the sort() method in List over Collections.sort()?
Performance and Memory
⏷ 34. What Are the Time/Space Complexities of HashMap, ArrayList, and LinkedList?
⏷ 35. How does HashMap achieve O(1) performance for insertions and lookups?
⏷ 36. What is the memory overhead of a HashSet compared to a TreeSet?
⏷ 37. How can you optimize memory usage for collections?
Advanced Topics
⏷ 38. What is an IdentityHashMap, and how does it differ from a HashMap?
⏷ 39. How do NavigableMap and NavigableSet differ from SortedMap and SortedSet?
⏷ 40. How does EnumMap improve performance for maps with enum keys?