Site icon Narayana Tutorial

What is difference between List, Set and Map

Classes and Objects interview questions

1. What is difference between List, Set and Map?

List

The following most useful classes implementing List interface

1. ArrayList  2. LinkedList  3. Vector

Set

The following most useful classes implementing Set interface

1. HashSet  2. LinkedHashSet 3. TreeSet

Map

The following most useful classes implementing Map interface

1. HashMap 2. LinkedHashMap 3. Hashtable  4. TreeMap

2. When to use List, Set and Map ?

List

Set

Map

3. What is difference between ArrayList, Vector and LinkedList?

ArrayList