Collection Interview Questions

Java collection interview questions

Simple General questions

1) What is the Java Collections? List down its advantages in java programming?
2) Explain Collections hierarchy in details?
3) Why Collection interface does not extend Cloneable and Serializable interface? describe in detail?

List Interface related Questions

5) Why we use List interface over the array? What are main implementing classes in List interface?
6) What is the way to convert an array of String to ArrayList?
7) How to reverse the list with using predefine method and with out?

Set interface related Questions

8) Why we use Set interface over the list? What are main implementing classes in Set interface?
9) How HashSet store elements internally describe in details?
10) Can a null element added to a TreeSet or HashSet?

Map interface related Questions

11) Why we use Map interface and what is the importance in collection? What are main implemention classes of Map interface?
12) What are IdentityHashMap and WeakHashMap?
13) Explain ConcurrentHashMap? How it works describe in details?
14) Describe the HasMap internal working in details?
15) How to design a good key for hashmap or what is the best approache to create a hashmap key?
16) What are different Collection views provided by Map interface?
17) When to use HashMap or TreeMap or describe the uses in details?

Collection interface & their implemented class difference questions

18) Difference between Set and List interface?
19) Difference between List and Map interface?
20) Difference between HashMap and HashTable class in collection?
21) Difference between Vector and ArrayList class in collection?
22) Difference between Iterator and Enumeration?
23) Difference between HashMap and HashSet?
24) Difference between Iterator and ListIterator?
25) Difference between TreeSet and SortedSet?
26) Difference between ArrayList and LinkedList?

More important questions

27) How to make a collection read only or what is the way to make the collection read only?
28) How to make a collection thread safe? what is the way to make the collection thread safe?
29) Why there is not method like Iterator.add() to add elements to the collection?
30) What are different ways to iterate over a list?
31) What do you understand by iterator fail-fast property?
32) What is difference between fail-fast and fail-safe?
33) How to avoid ConcurrentModificationException while iterating a collection?
34) What is UnsupportedOperationException?
35) Which collection classes provide random access of it’s elements?
36) What is BlockingQueue?
37) What is Queue and Stack, list their differences?
38) What is Comparable and Comparator interface?
39) What are Collections and Arrays class?
40) Recommended resources

Related Articles

post a comment