jdk1.8 利用流字符串转集合

        List idList = Arrays.stream(StringUtils.split(ids, ","))
                .map(id -> Long.parseLong(id.trim()))
                .collect(Collectors.toList());

     List categoryList = new ArrayList<>();
        getAllCategoryResponse.getCategoryList().forEach(byteString -> {
            categoryList.add(byteString.toStringUtf8());
        }); 
  

 

你可能感兴趣的:(JAVA)