Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;

import java.util.Iterator;

public class Main {
    public static <K> void addAllToArray(K[] destination, Collection<K> toBeAdded) {
        if (destination != null && toBeAdded != null) {

            int inx = 0;
            for (Iterator<K> iterator = toBeAdded.iterator(); iterator.hasNext(); inx++) {
                K k = iterator.next();
                destination[inx] = k;
            }
        }
    }
}