获取的数据类型中存有日期类型,并且根据日期来进行升降序排列:
升序
list.stream().sorted(Comparator.comparing(PrescribedDate::getPrescribedDate)).collect(Collectors.toList());
降序
list.stream().sorted(Comparator.comparing(PrescribedDate::getPrescribedDate).reversed()).collect(Collectors.toList());