从 CObArray 到 ArrayList
我有一些 C++ 代码片段将对象存储在 CObArray 中。我想使用 ArrayList 在 Java 中重新编码相同的部分来存储相同的对象。整体效率会有差异吗?
那么 ArrayList 是 CObArray 的确切对应类吗?
I have some pieces of C++ code that store objects in CObArray. I want to re-code the same pieces in Java using ArrayList to store the same objects. Will there be any difference in the overall efficiency?
So is ArrayList the exact correspondent class for CObArray?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道 CObArray 是什么: CObArray是 MS 的 C++ 实现的一部分。
他们对
CObArray
的描述听起来就像它的行为方式与ArrayList
类似。也就是说,在实施和性能方面。您应该记住,接口肯定会有所不同。例如,Java 的 ArrayList 没有类似GetUpperBound()
。如果你依赖这样的东西,你肯定可以确保你可以在没有相应方法的情况下生活。此外,在 Java 中使用 ArrayList 的首选方法是使用泛型(指定编译时集合中存在的类型,而不是运行时执行的强制转换) )。这听起来可能与根据 AJG85 的
CObArray
的工作方式不同。您还必须确保在开始转换为 Java 之前,您了解此类差异及其工作原理。I didn't know what a CObArray was: CObArray is part of MS's C++ implementations.
They description of a
CObArray
sounds like it behaves in a similar fashion to anArrayList
. That is, in terms of implementation and performance. You should bare in mind that the interfaces will differ for sure. For example, Java'sArrayList
does not have anything likeGetUpperBound()
. If you depend on something like this, you sure ensure you can live without corresponding methods.In addition, the preferred way to work with
ArrayList
's in Java is by the use of Generics (specify the type that will exist in the collection at compile-time as opposed to casts performed at run-time). This sounds like it may differ from how it works withCObArray
's according to AJG85. You must also ensure that before you begin your conversion to Java that you are aware of differences like this and how they work.