Java Collection Element Get getCollection(T... items)

Here you can find the source of getCollection(T... items)

Description

Returns a Collection with the given items.

License

Open Source License

Parameter

Parameter Description
items the items which should be included in the Collection.

Return

a Collection.

Declaration

public static <T> Collection<T> getCollection(T... items) 

Method Source Code


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

import java.util.Collection;

import java.util.List;

public class Main {
    /**/*from   ww w .  j  ava  2 s.c  om*/
     * Returns a Collection with the given items.
     * 
     * @param items the items which should be included in the Collection.
     * @return a Collection.
     */
    public static <T> Collection<T> getCollection(T... items) {
        List<T> list = new ArrayList<T>();

        for (T item : items) {
            list.add(item);
        }

        return list;
    }
}

Related

  1. getClassFromCollection(Collection collection)
  2. getClosest(final String pattern, Collection targets)
  3. getCollection(final Iterable iterable)
  4. getCollection(final String iText, final int iStartPosition, final Collection iCollection)
  5. getCollection(Object entity)
  6. getCollectionClass(TT tt)
  7. getCollectionClosingSymbol(Collection col)
  8. getCollectionPreview(final Collection collection, int previewSize)
  9. getCollectionSize(Collection collection)