数据库查询出好多都数据,需要根据特定的几个字段进行去冲,那么咋实现
一行代码实现(使用Java8 的 流)
// List infos = infoList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(
// () -> new TreeSet<>(Comparator.comparing(o -> o.getStationId() + "#" + o.getDataTime()+"#" +o.getTimeIndex()))),
// ArrayList::new));