Java Collection Create createCollection(X o)

Here you can find the source of createCollection(X o)

Description

create Collection

License

Open Source License

Declaration

public static <X> Collection<X> createCollection(X o) 

Method Source Code


//package com.java2s;
import java.util.*;

public class Main {
    public static <X> Collection<X> createCollection(X o) {
        return createList(o);
    }/*from  w  ww  .java2s.  c  o m*/

    public static <X> List<X> createList(X o) {
        List<X> c;
        if (o == null) {
            c = Collections.emptyList();
        } else {
            c = new ArrayList<X>(1);
            c.add(o);
        }
        return c;
    }
}

Related

  1. createAuthorString(Collection users)
  2. createCollection( final Iterable object)
  3. createCollection(Collection col)
  4. createCollection(Object[] objects)
  5. createCollection(T... items)
  6. createCollectionFromString(String value)
  7. createCSV(Collection list)
  8. createCsvString(Collection in)
  9. createFloatArray(java.util.Collection collection)