union To Array List - Java Collection Framework

Java examples for Collection Framework:ArrayList

Description

union To Array List

Demo Code


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

public class Main {
    public static <T> List<T> unionToArrayList(
            final Collection<T> collection, final T... items) {
        final ArrayList<T> result = new ArrayList<T>(collection.size()
                + items.length);/*from w w  w .j av a2 s.  co m*/
        result.addAll(collection);
        Collections.addAll(result, items);
        return result;
    }
}

Related Tutorials