我有一个像下面这样的课程,
public class Inventory {
private String name;
private List<Sample> samples;
}
public class Sample {
private int count;
private String date;
}
List<Inventory> inventories;
Run Code Online (Sandbox Code Playgroud)
我已经samples按日期排序了。没关系。但我需要按 Sample 类中的字段inventories对列表进行排序date。samples已经排序了。所以我需要库存按样品日期 DESC 排序。例如,
在该inventories列表中,如果有 3 个数据,
Inventory 1
name = 1
samples has dates of = List of (2021-07-02, 2021-07-03)
Inventory 2
name = 2
samples has dates of = List of (2021-07-02, 2021-09-03, 2021-10-03)
Inventory 3
name = 3
samples has dates …Run Code Online (Sandbox Code Playgroud)