List of utility methods to do List Zip
List | zip(final List Zips 2 lists together. ArrayList<Element> result = new ArrayList<Element>(); for (int i = 0; i < l1.size(); i++) { result.add(l1.get(i)); result.add(l2.get(i)); return result; |
List | zip(List zip List<Double> out = new ArrayList<Double>(); for (int i = 0; i < Math.min(a.size(), b.size()); i++) out.add(a.get(i) * b.get(i)); return out; |
List
| zip(List
zip 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; |
List
| zip(List
zip List<List<T>> zipped = new ArrayList<List<T>>(); for (List<T> list : lists) { for (int i = 0, listSize = list.size(); i < listSize; i++) { List<T> zipList; if (i >= zipped.size()) { zipped.add(zipList = new ArrayList<T>()); } else { zipList = zipped.get(i); ... |
List | zipDoubleArray(List zip Double Array 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; |
List
| zipper(List
Given a list of equal-sized lists, group the ith elements of each inner list with each other. if (listOfLists == null) { return null; List<List<E>> result = new ArrayList<List<E>>(); int innerLength = maxInnerSize(listOfLists); for (int i = 0; i < innerLength; ++i) { result.add(new ArrayList<E>()); for (Iterator<List<E>> it1 = listOfLists.iterator(); it1.hasNext();) { List<E> innerList = it1.next(); int index = 0; for (Iterator<E> it2 = innerList.iterator(); it2.hasNext(); ++index) { E element = it2.next(); List<E> resultList = result.get(index); resultList.add(element); return result; |