java中如何将list链表转换成list链表
除了循环一个个转,还有其他快速的方法吗
new ArrayList<Integer>().stream().map(Long::valueOf).collect(Collectors.toList());
没有其他方法,不过你可以写的简单点
listI.forEach((x) -> listL.add((long)x));
//试试能不能转换,addAll的实现应该也是循环实现的
list<Long> .addAll(list<Integer>)