我有一个对象列表.那些对象(以及其他)有一个私有的int数组(如果有帮助,我可以将它转移到List中).这个数组有一个公共Getter.所有阵列大小相同.
我想根据它们的数组对Object进行排序,如下所示:
Unsorted:
{[0, 1, 4, 5],
[0, 0, 2, 3],
[0, 1, 1, 2]}
Sorted:
{[0, 0, 2, 3],
[0, 1, 1, 2],
[0, 1, 4, 5]}
Run Code Online (Sandbox Code Playgroud)
在单词(它被称为词典编纂):
我设法用普通的比较器搜索它们,例如只搜索数组的第一个元素,但我不知道如何搜索它们.
我有一个实现 Iterable 的自定义列表(不是集合!!)。我没有实现 List ,因为这会带来太多我不想要的方法,而且我不需要。
关于我的 CustomList 的更多信息:
所以这是我的班级:
public class CustomList implements Iterable<MyThing> {
private final CustomList sublist;
private final MyThing thing;
// getters and other methods
}
Run Code Online (Sandbox Code Playgroud)
我有一个
Comparator<MyThing>
Run Code Online (Sandbox Code Playgroud)
我的事情:
public class MyThing {
private final IntArrayList values;
// more members and methods
}
Run Code Online (Sandbox Code Playgroud)
我想获得一个排序副本作为我的 …