array clone() vs Arrays.copyOf()

Ulf Zibis Ulf.Zibis at
Wed Apr 27 09:09:13 UTC 2011

Am 27.04.2011 02:34, schrieb David Holmes:
> Hi Stuart,
> Actually my comments more a response to Remi's assertion that clone should have been used instead, 
> without giving any technical rationale as to why clone would be better, and so much better that it 
> warranted Lance changing the code.
> Personally I think we should be steering people to Arrays.copyOf for all their array copying needs.
Hm, why?

> clone() is effectively legacy code.
What does that mean?

I prefer clone():
- less to type
- better to read, especially in looong code lines, e.g. as method call argument
- in-advanced reader potentially has less need to refer the doc
- potentially faster, at least in interpreter and C1?


BTW: Did you answer to the wrong thread (see attached screen shot) ? That was the reason why I came 
aware about this post ;-)

More information about the core-libs-dev mailing list