add varargs to Collection - Android java.util

Android examples for java.util:Collection

Description

add varargs to Collection

Demo Code


//package com.java2s;
import java.util.Arrays;
import java.util.Collection;

public class Main {
    public static final <T> void add(Collection<T> collection, T... values) {
        if (values == null || values.length == 0) {
            return;
        }/*from   w  w w  .j  av a  2  s.  com*/
        collection.addAll(Arrays.asList(values));
    }
}

Related Tutorials