News for hackers. Stuff that matters.
Re:Modern programming languages require generics by layer8 on Tuesday May 24, 2022 @12:03PM (#31493814)
Collections.sort() just copies the list into an array, sorts the array, and copies the sorted elements back into the list. So it also just sorts an array under the hood. To eliminate the temporary array (at least for ArrayList), the List#sort() method was added in Java 8.

Arrays are usually still preferred over collections in the case of primitive types (int[] etc.).

There are no comments on this comment yet.