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?
I didn’t know what a CObArray was: CObArray is part of MS’s C++ implementations.
They description of a
CObArraysounds 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’sArrayListdoes 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.