Java中std :: vector的等价物? [英] Equivalent of std::vector in Java?

查看:126
本文介绍了Java中std :: vector的等价物?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java中与std :: vector最接近的是什么?我的意思是,这个类可以将T引入其构造函数,然后是pushBack,popBack(),它存储在连续内存(不是链表)中。

What would be the closest thing to a std::vector in Java? By this I mean, a class which can take in T into its constructor and then pushBack, popBack() and that is stored in continuous memory (not linked list).

谢谢

推荐答案

ArrayList

一切都存储在数组(连续内存)内部,虽然操作名称有点不同。

ArrayList
Everything's stored in array ("continuous memory") internally, although operation names are a bit different.

关于列表实施的更多信息Java

关于泛型

编辑

帮助方法在他的回答中也提到了有用的课程(虽然不完全等同于C ++ Vector)。

edit
Helper Method also mentioned useful class in his answer (although not exactly equivalent to C++ Vector).

这篇关于Java中std :: vector的等价物?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆