commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Louis Tribble" <louis.trib...@webgain.com>
Subject Re: [SUBMIT] OptimizedFastArrayList
Date Wed, 17 Apr 2002 17:55:35 GMT
> "clone" I really mean "reallocate".  java.util.ArrayList uses 
> System.arraycopy in its add(int, Object) implementation; and the javadoc
> for System.arraycopy indicates that if the source and target arrays
> are the same, a new array is allocated, the source is copied to the 
> new array, and then the contents of the new array replace the original:

I don't read it that way at all. The javadoc says:
"...then the copying is performed AS IF [my emphasis] the components 
at  positions srcPos through srcPos+length-1 were first copied to a 
temporary array..."

Reallocation is _not_ necessary when implementing arraycopy,
just care in handling the overlap cases.

Louis Tribble


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message