我正在尝试将2D列表转换为2D int数组.但是,似乎我只能收集对象,而不是基元.
当我做:
data.stream().map(l -> l.stream().toArray(int[]::new)).toArray(int[][]::new);
Run Code Online (Sandbox Code Playgroud)
我得到编译时错误Cannot infer type argument(s) for <R> map(Function<? super T,? extends R>).
但是,如果我int[]改为Integer[],则编译.我如何才能使用它int?