add All elements from Iterable to Collection - Java java.util

Java examples for java.util:Iterable Element

Description

add All elements from Iterable to Collection

Demo Code


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

public class Main {
    static <V> void addAll(final Collection<V> collection,
            final Iterable<V> values) {
        if (values != null) {
            for (final V value : values) {
                collection.add(value);/*from w w  w  .ja  va  2s  . c o m*/
            }
        }
    }
}

Related Tutorials