Java Readme

stream

  • 使用stream构造逗号分割字符串并用括号包括
List<Integer> ids = Lists.newArrayList(1, 2, 3);
String s = ids.stream().map(String::valueOf).collect(Collectors.joining(",", "(", ")")); // (1,2,3)
posted @ 2022-12-30 18:27  weiwei5987  阅读(25)  评论(0编辑  收藏  举报