Q. What is the difference between List and Set?

Ans:-

s.NoListSet
1.List allow duplicatesSet 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 classWhere as set interface does not have any legacy class
4.The List Interface can allow n number of null values5.set Interface only allows a Single null value

Leave a Reply

Your email address will not be published. Required fields are marked *

*