List<String> names = new ArrayList<>();
httpIds.sort(Integer::compareTo);
httpIds.forEach(id -> names.add(Arrays.asList(marketCache.getHttpById(id).getHttpUrl().split("/")).stream().reduce((first, second) -> second).orElse("no last element")+"-"+marketCache.getHttpById(id).getDescription()));
return String.join(";", names);插入代码片
stream获取List最后一个元素
最新推荐文章于 2024-08-16 10:09:10 发布