commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Louis Tribble" <>
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:   <>
For additional commands, e-mail: <>

View raw message