Java8新特性

2021-08-30  本文已影响0人  Leslie_Lee

//去重某一个字段

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)

上一篇 下一篇

猜你喜欢

热点阅读