我知道如何使用 Arrays.sort() 方法按以下方式对对象数组进行排序。
Arrays.sort(array of primitive type);
Arrays.sort(array of primitive type, from, to);
Arrays.sort(array of an object type);
Arrays.sort(array of an object type , from, to);
Run Code Online (Sandbox Code Playgroud)
但我不知道以下两种方法。
Arrays.sort(array of an object type , comparator);
Arrays.sort(array of an object type , from, to, comparator);
Run Code Online (Sandbox Code Playgroud)
有人可以让我知道如何使用这些方法对类型对象的数组进行排序吗?我请求您添加代码或任何指向 .java 类的链接。我尝试搜索它但找不到它。
谢谢。