What is difference between sets and lists? - Java

What is difference between sets and lists?

Sets Lists
They have unique valuesThey have duplicate values
It is an unordered collection It is an ordered collection.
Set implements HashSet, LinkedHashSet, TreeSet etc.List implements ArrayList, LinkedList etc.
It can only have a single null valueIt can have any number of null values
An Iterator can be used to traverse a set.A ListIterator is used to traverse a list in both the directions.
It does not have any legacy class.It has a legacy class called Vector.
What is fail-fast iterator in Java? What is it used for?
The unsynchronized collections and their modifications, iterations are termed as ‘fail-fast’ iterators. An iterator that implements Iterable interface...
How to store and retrieve serialized objects to and from a file in Java?
The object’s current state can be persisted and retrieved by using the concept known as ‘serialization’. This is done on an object to a stream...
What is relation between JAXP and Xerces? - Java
Xerces is a group of libraries for parsing, serializing, validating and manipulating XML...
Post your comment