Here you can find the source of toList(Iterable
static <T> List<T> toList(Iterable<T> self)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { static <T> List<T> toList(Iterable<T> self) { List<T> answer = new ArrayList<T>(); for (T t : self) { answer.add(t);/*from ww w . j av a2s . c o m*/ } return answer; } }