Here you can find the source of toList(T only)
public static <T> List<T> toList(T only)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> toList(T only) { ArrayList<T> result = new ArrayList<T>(); result.add(only);/*from w w w . j a v a 2 s.com*/ return result; } }