Question:
Perhaps because LinkedList is supposedly a doubly linked list (otherwise it could not implement the Deque interface). And adding a doubly linked list is operation 0 (1).
The method addAlldoes not work in constant time.
addAll
This is also possible because LinkedHashSet"it supports a doubly linked list passing through all its entries."
LinkedHashSet
, .. LinkedHashSet LinkedList , , .
LinkedList
, - , node, , , , , . , , - , , .
, , , , Java API , .
. LinkedList node, node node LinkedList.
LinkedHashSet: , .
, , , , .
, . Set<Whatever> whatever = SOME CONSTRUCTOR, List<Whatever> list = new LinkedList(whatever);, LinkedList Collections Set Collections.
Set<Whatever> whatever = SOME CONSTRUCTOR
List<Whatever> list = new LinkedList(whatever);