Hi I want to copy an array...and I do not want to use "clone" which is slow to copy.. I tried arraycopy and copyOf, but it is not working
for (int i = 0; i < arraySize; i++) {
City[] tempCities = Arrays.copyOf(cities, cities.length) ;
distance = 0;
tempCities[i].setVisited();
}
but this modify my original array(cities). Does anyone know how to copy and not have another pointer to the same object