Java List Zip zipDoubleArray(List lists)

Here you can find the source of zipDoubleArray(List lists)

Description

zip Double Array

License

Open Source License

Declaration

public static List<double[]> zipDoubleArray(List<double[]> lists) 

Method Source Code


//package com.java2s;
/*/*from   w ww .  ja v a 2 s  . com*/
 * AACalc - Asset Allocation Calculator
 * Copyright (C) 2009, 2011-2016 Gordon Irlam
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<double[]> zipDoubleArray(List<double[]> lists) {
        List<double[]> result = new ArrayList<double[]>();
        int len0 = lists.get(0).length;
        int len1 = lists.size();
        for (int i = 0; i < len0; i++) {
            double[] array = new double[len1];
            for (int j = 0; j < len1; j++) {
                array[j] = lists.get(j)[i];
            }
            result.add(array);
        }
        return result;
    }
}

Related

  1. zip(final List l1, final List l2)
  2. zip(List a, List b)
  3. zip(List> lists)
  4. zip(List> lists)
  5. zipper(List> listOfLists)