push_back() and push_front() in Java
Is there any collection class in java, that implements pus开发者_Python百科h_back()
and push_front()
methods?
The class java.util.LinkedList
has addFirst/Last(), getFirst/last() and removeFirst/Last().
Any collection that implements Deque
should have it (ArrayDeque
, LinkedList
)
The List
appears to with both add
functions.
https://docs.oracle.com/javase/1.5.0/docs/api/java/util/List.html
精彩评论