I can't remember peek poll. A large pile of operations, record the difference deque interface
AddFirst AddLast
Offerfirst Offerlast
Removefirst Removelast
Pollfirst Polllast
GetFirst GetLast
Peekfirst Peeklast
(Push pop stack operation is very good to distinguish) Queue Interface
Add offer offer remove poll element peek
Found Deque interface is corresponding to the queue interface on the basis of the operation of each song xx derived from Xxfirst and xxlast, so we just need to see the difference between the XX method
Add if it doesn't fit, throw the exception illegalstateexception
The difference between an offer and an add is simply that if it doesn't fit, return false
The difference between remove and poll and add and offer similar remove if the queue is an empty throw exception and poll returns null
Elment and peek The pair are also elment if the queue is an empty throw exception and peek returns null but neither of them is back. Delete elements from the queue