美文网首页
Java8新特性

Java8新特性

作者: Leslie_Lee | 来源:发表于2021-08-30 22:00 被阅读0次

//去重某一个字段

List<A>list = list.stream().collect(Collectors.collectingAndThen((Collectors.toCollection(() ->

new TreeSet<>(Comparator.comparing(a -> a.getLineName())))), ArrayList::new));

//取第一条数据

ADto eventDto = aList.stream().findFirst().orElse(null);

//求和(mapToInt)

Integer aa = stockResult.stream().mapToInt(AvailableStockDto::getErpStockQty).sum();

@ApiModelProperty("")

@AllArgsConstructor

@NoArgsConstructor

@Data

@Builder

@FieldDefaults(level = AccessLevel.PRIVATE)

相关文章

网友评论

      本文标题:Java8新特性

      本文链接:https://www.haomeiwen.com/subject/ccwqsltx.html