伍特: [code=java] @Test public void test1() { List<String> list = Arrays.stream(new String[]{"a", "b", "c"}).collect(Collectors.toList()); list.replaceAll(x -> x + "test"); list.replaceAll(x -> {x = x + "te";x = x + "xt"; return x;}); // 这一行和 replaceAll 等价。我理解可以对当前元素做任何操作 list = list.stream().map(x -> {x = x + "te";x = x + "xt"; return x;}).collect(Collectors.toList()); System.out.printf(JSON.toJSONString(list)); } [/code]
Redis-x64-5.0.14.1.msi & Redis-Desktop-Manager-0.9.3.817 的下载与安装
Java 关于List接口中的replaceAll() 方法