Here you can find the source of toList(Iterable
public static <T> ArrayList<T> toList(Iterable<T> it)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; public class Main { public static ArrayList<Double> toList(double[] xs) { ArrayList<Double> list = new ArrayList(); for (double x : xs) list.add(x);/*from w ww.ja va 2s . co m*/ return list; } public static <T> ArrayList<T> toList(Iterable<T> it) { if (it instanceof ArrayList) return (ArrayList) it; ArrayList<T> list = new ArrayList<T>(); for (T x : it) list.add(x); return list; } public static double[] add(double[] v1, double[] v2) { double[] sumv = new double[v1.length]; for (int i = 0; i < v1.length; i++) sumv[i] = v1[i] + v2[i]; return sumv; } public static double[] add(double[] v1, int[] v2) { double[] sumv = new double[v1.length]; for (int i = 0; i < v1.length; i++) sumv[i] = v1[i] + v2[i]; return sumv; } public static double[] add(double[] v1, double x) { double[] sumv = new double[v1.length]; for (int i = 0; i < v1.length; i++) sumv[i] = v1[i] + x; return sumv; } }