Java Collection Create toCollection(C c, E... elements)

Here you can find the source of toCollection(C c, E... elements)

Description

to Collection

License

Open Source License

Declaration

@SafeVarargs
    public static <E, C extends Collection<E>> C toCollection(C c, E... elements) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    @SafeVarargs
    public static <E, C extends Collection<E>> C toCollection(C c, E... elements) {
        if (elements != null) {
            for (E element : elements) {
                c.add(element);/*  w ww.  j  a v a 2  s  .com*/
            }
        }

        return c;
    }
}

Related

  1. createTextFromList(Collection list)
  2. createUniqueName(String baseName, Collection names)
  3. stringToCollection(String string)
  4. stringToCollection(String string)
  5. stringToCollection(String string, String delim)
  6. toCollection(Class cls, Iterable iterable)
  7. toCollection(Class cls, T[] array)
  8. toCollection(final char[] charArray)
  9. toCollection(final Iterable iterable)