java8中stream将字符list转换大小写

List lowCaseList = new ArrayList<>();
  lowCaseList.add("dog");
  lowCaseList.add("cat");
  lowCaseList.add("tiger");
  lowCaseList.add("lion");
   List upperCaseList = lowCaseList.stream().map(String::toUpperCase).collect(Collectors.toList());
   System.out.println(upperCaseList.toString());

//结果:[DOG, CAT, TIGER, LION]

转载于:https://www.cnblogs.com/sikuaiwu/p/11385354.html

你可能感兴趣的:(java8中stream将字符list转换大小写)