list泛型 强转 为子类型

list泛型  强转 为子类型

List<Number> list = new ArrayList<>();
List<Integer> collect = list.stream()
.map(x->(Integer)x)
.collect(Collectors.toList());
posted @ 2018-09-21 11:59  圣诞浮云  阅读(2497)  评论(0)    收藏  举报