Here you can find the source of zip(List> lists)
public static <T> List<List<T>> zip(List<List<T>> lists)
//package com.java2s; /*/*from w w w . j a v a2s . c o m*/ * 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 <T> List<List<T>> zip(List<List<T>> lists) { List<List<T>> result = new ArrayList<List<T>>(); for (int i = 0; i < lists.get(0).size(); i++) { List<T> l = new ArrayList<T>(); for (List<T> in : lists) { l.add(in.get(i)); } result.add(l); } return result; } @SafeVarargs public static <T> List<List<T>> zip(List<T>... lists) { List<List<T>> result = new ArrayList<List<T>>(); for (int i = 0; i < lists[0].size(); i++) { List<T> l = new ArrayList<T>(); for (List<T> in : lists) { l.add(in.get(i)); } result.add(l); } return result; } }