Here you can find the source of asList(Collection collection)
@SuppressWarnings("unchecked") static public <E> List<E> asList(Collection collection)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collection; import java.util.List; public class Main { @SuppressWarnings("unchecked") static public <E> List<E> asList(Collection collection) { List<E> result = new ArrayList<E>(); for (Object obj : collection) { result.add((E) obj);//from w w w .j a va 2 s . co m } return result; } @SuppressWarnings("unchecked") static public <E> List<E> asList(Collection collection, E[] a) { List<E> result = new ArrayList<E>(); for (Object obj : collection) { result.add((E) obj); } return result; } }