先看下collectors类的结构,里面有collector接口的实现 CollectorImpl以及自己定义的一些静态方法
构造对象
@Data
@AllArgsConstructor
static class Achievement{
private String name;
private double score;
private String date;
}
static List<Achievement> getData(){
List<Achievement> list = new ArrayList<>();
list.add(new Achievement("wang",80,"2017-10-20"));
list.add(new Achievement("wang",90,"2017-5-20"));
list.add(new Achievement("li",90,"2018-10-20"));
list.add(new Achievement("zhao",50,"2017-10-20"));
list.add(new Achievement("qian",60,"2017-10-22"));
list.add(new Achievement("sun",20,"2017-10-23"));
list.add(new Achievement("sun",20,"2017-11-23&