Java examples for java.util:Collection Creation
Create Collection of one element
//package com.java2s; import java.util.ArrayList; import java.util.Collection; import java.util.List; public class Main { public static <T> Collection<T> toCollection(T element) { List<T> list = new ArrayList<T>(1); list.add(element);/*from ww w. ja va 2s . c o m*/ return list; } }