> "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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to