Fastest way to sort an array of objects in java
问题 I have a Class called apple which contains 3 values as int x , int y and int weight . Then i created an array of apple type objects. Now i want to sort the the array of objects based on weight meaning the the apple object with the lowest weight should be first and so on. I know there are quite a few ways to achieve this by using Arrays.sort etc or comparators. I was wondering what is the fastest way of doing this sort in Java? There can be a case where i have 500,000 objects so i want to know