根据日期从List <object>获取元素

时间:2019-04-19 13:39:19

标签: java arrays sorting date

我有类似的对象列表,

List<Student> list = new ArrayList<Student>();

list.add(new Student("abc","2019-02-01"));
list.add(new Student("bcd","2019-02-01"));
list.add(new Student("cdf","2019-02-01"));
list.add(new Student("fgh","2019-02-01"));
list.add(new Student("abc","2019-02-02"));
list.add(new Student("bcd","2019-02-02"));
list.add(new Student("cdf","2019-02-02"));
list.add(new Student("fgh","2019-02-02"));

我需要从object []中获取从最低日期到最高日期的元素。

1 个答案:

答案 0 :(得分:0)

使用 Interval = 1 Interval type= Number 对其进行排序。

Comparator