集册 Java实例教程 流采集器到二维数组

流采集器到二维数组

欢马劈雪     最近更新时间:2020-01-02 10:19:05

465
流采集器到二维数组


//package com.nowjava;/*nowjava - 时  代  Java 提 供*/

import java.util.Collection;


import java.util.stream.Collectors;


import java.util.stream.Stream;


public class Main {

    public static void main(String[] argv) throws Exception {

        Collection collection = java.util.Arrays.asList("asdf",

                "nowjava.com");

        System.out/**来 自 NowJava.com - 时代Java**/

                .println(java.util.Arrays.toString(to2DArray(collection)));

    }


    public static double[][] to2DArray(Collection<double[]> collection) {

        return collection.toArray(new double[collection.size()][]);

    }


    public 
展开阅读全文