Wednesday, 9 September 2015

Java- Differences between List and Set


List
Set
1.         List allows duplicate elements.
 Set doesn’t allow duplicates.

2.         List allows any number of null values.
 Set allows single null value at most.

3.         List is an ordered collection. it maintains
Insertion order or element.

 Set doesn’t maintain any order.
 Set is an unordered collection. You get no  guarantee on which order element will be stored.



No comments:

Post a Comment