List :
- List is ordered grouping elements
- List provides positional access in the elements of the collections.
- We can store duplicate elements in the list.
- List interface is implemented by
ArrayList,LinkedList,Vector, andStack. - List can store multiple null elements.
Set :
- Set is unordered grouping elements.
- Set doesn’t provide positional access in the elements of the collections.
- We can’t store duplicate elements in the set.
- Set interface is implemented by
HashSetandLinkedHashSet. - Set can store only one null element.
| Factor | List | Set |
|---|---|---|
| Is ordered grouping elements? | YES | NO |
| Provides positional access by index? | YES | NO |
| Can store duplicate elements? | YES | NO |
Can store multiple null elements? | YES | NO |
| Childs: | ArrayList, LinkedList, Vector, and Stack | HashSet and LinkedHashSet |