Here you can find the source of asList(Iterable
Parameter | Description |
---|---|
iterable | The Iterable |
T | The type of objects contained in the {Iterable} |
public static <T> List<T> asList(Iterable<T> iterable)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { /**/*www.ja v a2s . c o m*/ * Returns a {List} of the contents for the given {Iterable} * * @param iterable The Iterable * @param <T> The type of objects contained in the {Iterable} * @return A {List} of the iterable's objects */ public static <T> List<T> asList(Iterable<T> iterable) { List<T> list = new ArrayList<T>(); for (T item : iterable) { list.add(item); } return list; } }