Append array to Collection - Android java.util

Android examples for java.util:Collection

Description

Append array to Collection

Demo Code


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

public class Main {
    public final static <T> void Append(Collection<T> collection, T[] array) {
        if (collection != null && array != null && array.length > 0) {
            for (T element : array) {
                collection.add(element);
            }//w  w w  . j  av  a2  s  . c  o m
        }
    }

    public final static <T> void Append(Collection<T> collection,
            T[][] array_array) {
        if (collection != null && array_array != null
                && array_array.length > 0) {
            for (T[] array : array_array) {
                Append(collection, array);
            }
        }
    }
}

Related Tutorials