在Java8中使用lambda时不为null时才过滤值

List<Object> username=list.stream().map(ThirdChannelDTO->thirdChannelDTO.getChannelCOnfigInfo().get("username")).fileter(Objects::nonNull).distinct().Collect(Collectors.toList());

使用:filter(Objects::nonNull)

猜你喜欢

转载自blog.51cto.com/1929297/2578775