Java 中的 push_back() 和 push_front()

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2116962/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 19:32:06  来源:igfitidea点击:

push_back() and push_front() in Java

javacollectionsvectorpush-back

提问by folone

Is there any collection class in java, that implements push_back()and push_front()methods?

java中是否有任何实现push_back()push_front()方法的集合类?

回答by Jerome

The class java.util.LinkedListhas addFirst/Last(), getFirst/last() and removeFirst/Last().

该类java.util.LinkedList有 addFirst/Last()、getFirst/last() 和 removeFirst/Last()。

回答by fn.

Any collection that implements Dequeshould have it (ArrayDeque, LinkedList)

任何实现的集合都Deque应该有它 ( ArrayDeque, LinkedList)

回答by Daniel A. White

The Listappears to with both addfunctions.

List似乎与这两个add功能。

http://java.sun.com/j2se/1.4.2/docs/api/java/util/List.html

http://java.sun.com/j2se/1.4.2/docs/api/java/util/List.html