java中CollectionLong转换为 ListLong
可以使用Java 8中的stream API来实现Collection
Collection<Long> collection = new ArrayList<>();
// 添加元素到集合中
List<Long> list = collection.stream().collect(Collectors.toList());
或者使用List接口的构造函数,将Collection
Collection<Long> collection = new ArrayList<>();
// 添加元素到集合中
List<Long> list = new ArrayList<>(collection);
原文地址: https://www.cveoy.top/t/topic/YtK 著作权归作者所有。请勿转载和采集!