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 {
    /**
     * @return een int array van alle elementen uit de <tt>collection</tt>.
     */
    public static int[] toIntArray(Collection<Integer> collection) {
        int[] res = new int[collection.size()];
        Iterator<Integer> iterator = collection.iterator();
        for (int i = 0; i < collection.size(); i++) {
            res[i] = iterator.next();
        }
        return res;
    }
}