According to javadoc,
ArrayDeque class is likely to be faster than Stack when used as a stack
I don't understand how can ArrayDeque be faster than stack. Suppose stack is implemented using linkedlist as follows:
Push: Insert new element at the head, teamp->next = head; head = temp
(where temp is the element to be inserted)
Pop: Remove the element from head, and make head = head->next
For large number of elements, there will be a overhead for ArrayDeque to resize which won't be a case in Stack implemented using LinkedList. So how exactly is ArrayDeque faster than stack?