Chris et all,
Chris Sommers wrote:
>
> Folks,
> I believe that using arraycopy as shown below is not
> guaranteed to work. One cannot assume that elements of a
> Vector are stored in sequential memory locations, especially
> as the Vector changes in size and memory is allocated in a
> (possibly) fragmented manner obver time.
>
> - chris
The Vector class uses an array. The JVM may not store the elements of
the array in sequential memory locations, but that is not an issue. The
programming interface is well-defined, and the internals of the
arraycopy() method will handle non-contiguous arrays as well as
contiguous.
>
> Uncle George wrote:
> >
> > technically we are to change only the platform dependent code - hands tied
> > by license. Ur improvement would not fit into that catagory :( . PLEASE
> > file away at javasoft.
> > BTW this does not mean that it wont be used, or benefit those here. I have
> > no problem with this being posted here
> > gat
> >
> > Ernst de Haan wrote:
> >
> > > Small performance enhancement suggested.
> > >
> > > The performance of java.util.Vector.copyInto(Object[]) could be
> > > improved, I believe. Currently the implementation does something like:
> > >
> > > public void copyInto(Object[] anArray)
> > > {
> > > int i = elementCount;
> > > while (i-- > 0)
> > > {
> > > anArray[i] = elementData[i];
> > > }
> > > }
> > >
> > > Why not make it:
> > >
> > > public void copyInto(Object[] anArray)
> > > {
> > > System.arraycopy(elementData, 0, anArray, 0, elementData.length);
> > > }
> > >
> > > I personally use the copyInto method very often.
> > >
> > > Is this the place I should post such issues, or should I contact
> > > JavaSoft or so?
> > >
> > > Ernst
GreetinX++, Ernst
--
_________________________________________________________
| "Come to me all you who are weary and burdened, and I |
| will give you rest." |
| |
| -- Jesus Christ (Mt. 11:28) |
|_______________________ _________________________________|
| Ernst de Haan | email [EMAIL PROTECTED] |
| Java programmer | web members.xoom.com/znerd/ |
| Utrecht University | icq# 21871778 |
|_______________________|_________________________________|