Linked Questions

Popular Questions

Utility method for wrapping an object in a collection

Asked by At

I'm looking for a static method in the Java core libraries or some other commonly used dependency — preferably one of Apache — that does the following:

public static <T> Collection<T> wrap(final T object){
    final Collection<T> collection = new ArrayList<T>();
    return collection;

Do you know where such a method already exists? Since I guess the problem is common, I don't want to duplicate it's solution.

Related Questions