Your list contains array of references to objects of type Point
. So, when you create new array you allocate new memory and really create clone. However wehn you call System.arraycopy()
(that is just a faster version of ordinary loop you can code youreself) you copy content of each cell of your original array to appropriate cell of your target array, i.e. copy references.
If you want deep clone you have to create copy of each object of Point
. You can use either utility method or copy constructor or make Point
clonable:
for (Point[] foo: settings.getAstroidForms()) {
Point[] parr = new Point[foo.length];
for (int i = 0; i < parr.length; i++) {
parr[i] = new Point(foo[i]); // I assume here that you implemented correct copy constructor
}
}