add All Iterable<T> to Collection<T> - Java java.util

Java examples for java.util:Iterable Element

Description

add All Iterable<T> to Collection<T>

Demo Code


import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;

public class Main{
    public static <T> void addAll(Iterable<T> iterable,
            Collection<T> collection) {
        for (T item : iterable)
            collection.add(item);/*from  w w  w  . jav a  2 s  .com*/
    }
}

Related Tutorials