Q. What is the difference between List and Set?
Ans:-
| s.No | List | Set |
| 1. | List allow duplicates | Set does’t allow duplicates |
| 2. | The List is an ordered collection which maintains the insertion order. | Whereas set is an unordered collection which does not preserve the insertion order. |
| 3. | The List interface contains a single legacy class which is vector class | Where as set interface does not have any legacy class |
| 4. | The List Interface can allow n number of null values | 5.set Interface only allows a Single null value |