difference between set and list in java

www‮tual.‬turi.com
difference between set and list in java

List is a type of ordered collection that maintains the elements in insertion order while Set is a type of unordered collection, so elements are not maintained any order.

set vs list in Java

ListSet
The List is an ordered sequence.The Set is an unordered sequence.
List allows duplicate elementsSet doesn’t allow duplicate elements.
Multiple null elements can be stored.Null element can store only once.
Elements by their position can be accessed.Position access to elements is not allowed.
List implementations are ArrayList, LinkedList, Vector, StackSet implementations are HashSet, LinkedHashSet.
Created Time:2017-09-04 21:08:32  Author:lautturi