查看: 2387|回复: 0

空的列表在stream中的allMatch和noneMatch均返回true

Ray

升级   100%

31

主题

204

回帖

871

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
871
发表于 2018-8-5 19:55:05 | 显示全部楼层 |阅读模式
@Test
    public void test() {
        List<String> list = new ArrayList<>();
        System.out.println("allMatch:" + list.stream().allMatch(o -> StringUtils.length(o) > 1));
        System.out.println("noneMatch:" + list.stream().noneMatch(o -> StringUtils.length(o) > 1));
    }
allMatch:true
noneMatch:true
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系客服 关注微信 下载APP 返回顶部 返回列表
viewthread