Here you can find the source of asList(Object value)
public static List asList(Object value)
//package com.java2s; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Enumeration; import java.util.List; public class Main { public static List asList(Object value) { if (value == null) { return Collections.EMPTY_LIST; } else if (value instanceof List) { return (List) value; } else if (value.getClass().isArray()) { return Arrays.asList((Object[]) value); } else if (value instanceof Enumeration) { List answer = new ArrayList(); for (Enumeration e = (Enumeration) value; e.hasMoreElements();) { answer.add(e.nextElement()); }/*w ww.j a va 2 s . co m*/ return answer; } else { // lets assume its a collection of 1 return Collections.singletonList(value); } } }