Copying Generic Arrays in Java

from blog the website of jyn, | ↗ original
Intro Copying an array. It sounds so simple - run a quick for loop, or better yet, System.arraycopy. System.arraycopy(array, 0, tmp, 0, array.length); What if you need to perform a destructive operation? [1] In my Data Structures class, we're asked to implement heap sort without modifying the original array. This is simple enough: use...