流式操作

2021-09-18  本文已影响0人  抬头挺胸才算活着
        String result = s.chars()
            .mapToObj(x->(char)x)
            .filter(x -> x != '(' && x != ')')
            .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append)
            .toString();
Arrays.stream(dp).flatMapToInt(x -> Arrays.stream(x)).max().getAsInt();

flatMapToInt把二维数组中的每个一维数组转为一个IntStream

IntStream.range(0, x.length).mapToObj(idx -> x[idx])
上一篇 下一篇

猜你喜欢

热点阅读