Example & Tutorial understanding programming in easy ways.

What is difference between List and Set?

The difference between List and Set are following:-

                              List                             Set
1 List can contain duplicate values . 1 Set doesn’t allow duplicate. Set interface allows only to unique elements.
2 List is ordered collection based on zero based index. 2 Set is unordered collection ie Set doesn’t ensures the sequence in which data can be retrieved. (except SortedSet)
3 List does not prevent inserting null elements (as many you like). 3 Set will allow only one null element.


Read More →