Java Collection to Array toArray(Collection values)

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

Description

to Array

License

Apache License

Declaration

public static double[] toArray(Collection<Double> values) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

public class Main {
    public static double[] toArray(Collection<Double> values) {
        if (values == null) {
            throw new IllegalArgumentException("No null value allowed!");
        }/*from   w w w.j  a v a 2s .c om*/
        double[] result = new double[values.size()];
        int cnt = 0;
        for (Double value : values) {
            result[cnt++] = value;
        }
        return result;
    }
}

Related

  1. toArray(Collection bytes)
  2. toArray(Collection c, T[] arr)
  3. toArray(Collection collection)
  4. toArray(Collection tests)
  5. toArray(Collection list)
  6. toArray(Collection values)
  7. toArray(Collection collection)
  8. toArray(Collection collection)
  9. toArray(Collection collection, Long defaultValue)