Both interfaces are inherited from Collection.
List (inteface)
Order is the most important feature of List, which ensures that the specific order of elements is maintained.
-ArrayList allows fast random access to elements.
-LinkedList optimizes sequential access. The overhead of inserting and removing to the List is not high. It has addFrist(), addLast(), getFirst, getLast, removeFirst and removeLast(). These methods make LinkedList be regarded as a stack/ Queue/Bidirectional queue.
Set (inteface)
Each element stored in the Set must be unique, and the order of elements is not guaranteed. The Object added to the Set must define the equals() method - HashSet Set designed for quick search, and hashCode() must be defined in the HashSet object stored in the HashSet.
-TreeSet protects order Set, using it to extract ordered sequences from Set.
-LinkedHashSet has the query speed of HashSet and uses linked lists to maintain the order of elements.
The storage method between them is different:
TreeSet uses the red and black trees to sort elements according to the structure.
HashSet uses a hash function, which is designed specifically for fast queries.
LinkedHashSet uses hash internally to speed up querying, and also uses linked lists to maintain the order of elements.
When using HashSet/TreeSet, equals() must be defined for the class; and HashCode() is aimed at HashSet. As a programming style, when overriding equals(), it should be overridden at the same time.