Java Collection to Array toArray(Collection coll)

Here you can find the source of toArray(Collection coll)

Description

to Array

License

Open Source License

Declaration

public static int[] toArray(Collection<? extends Integer> coll) 

Method Source Code

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

import java.util.Collection;

public class Main {
    public static int[] toArray(Collection<? extends Integer> coll) {
        int[] target = new int[coll.size()];
        int pos = 0;
        for (int i : coll)
            target[pos++] = i;/* w w w . j a va2s . c o  m*/
        return target;
    }
}

Related

  1. collectionToObjectArray(final Collection _list)
  2. convertToArray(Collection collection)
  3. convertToArray(Collection input)
  4. convertToArray(Collection items)
  5. toArray(Collection c)
  6. toArray(Collection bytes)
  7. toArray(Collection c, T[] arr)
  8. toArray(Collection collection)
  9. toArray(Collection tests)