Skip to Content
InterviewJava Collections

Java Collections Interview Questions

List

1. What’s the difference between ArrayList and LinkedList?

2. How does ArrayList expansion mechanism work?

3. How to make ArrayList thread-safe?

4. How does CopyOnWriteArrayList work?

5. What’s the difference between Vector and ArrayList?

Set

6. How does HashSet work internally?

7. What’s the difference between LinkedHashSet and HashSet?

8. How does TreeSet work internally?

9. How does Set ensure elements are unique?

Map

10. How does HashMap work internally?

11. What are the differences between HashMap in JDK7 and JDK8?

12. How does HashMap resize?

13. What’s the execution flow of HashMap’s put method?

14. Why is HashMap not thread-safe?

15. What’s the difference between HashTable and HashMap?

16. How does ConcurrentHashMap work internally?

17. What are the differences between ConcurrentHashMap in JDK7 and JDK8?

18. How does LinkedHashMap work internally?

19. How does TreeMap work internally?

20. What’s the difference between HashMap and TreeMap?

Queue

21. What’s the difference between Queue and Deque?

22. What’s the difference between ArrayDeque and LinkedList?

23. How does PriorityQueue work internally?

24. What are the implementations of BlockingQueue?

25. What’s the difference between ArrayBlockingQueue and LinkedBlockingQueue?

Other Questions

26. What is fail-fast?

27. What is fail-safe?

28. What’s the difference between Iterator and ListIterator?

29. What’s the difference between Comparable and Comparator?

30. How to make collections thread-safe?

Last updated on