Java Collection to Array toIntArray(Collection collection)

Here you can find the source of toIntArray(Collection collection)

Description

to Int Array

License

Open Source License

Declaration

public static int[] toIntArray(Collection<Integer> collection) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static int[] toIntArray(Collection<Integer> collection) {
        if (collection == null)
            throw new RuntimeException(
                    "Can't do toIntArray. Collection is Null");
        int[] result = new int[collection.size()];
        int i = 0;
        for (Integer el : collection)
            result[i++] = el;/*from w  ww .  ja v  a  2 s . c  o m*/
        return result;
    }
}

Related

  1. toFloatArray(Collection array)
  2. toFloatArray(final Collection c)
  3. toIntArray(Collection coll)
  4. toIntArray(Collection coll)
  5. toIntArray(Collection collection)
  6. toIntArray(Collection collection)
  7. toIntArray(Collection collection)
  8. toIntArray(Collection ints)
  9. toIntArray(Collection list)