Java Collection to Array toDoubleArray(final Collection doubleColl)

Here you can find the source of toDoubleArray(final Collection doubleColl)

Description

Converts the given collection of Doubles to an array of Doubles.

License

BSD License

Parameter

Parameter Description
doubleColl The collection to convert.

Return

An array filled with the data in the given collection.

Declaration

public static Double[] toDoubleArray(final Collection<Double> doubleColl) 

Method Source Code


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

import java.util.Collection;

public class Main {
    /**//from ww  w.j  a v a  2s .  co m
     * Converts the given collection of Doubles to an array of Doubles. Returns
     * an empty array for null collections.
     * 
     * @param doubleColl
     *            The collection to convert.
     * @return An array filled with the data in the given collection.
     */
    public static Double[] toDoubleArray(final Collection<Double> doubleColl) {
        if (doubleColl == null) {
            return new Double[0];
        }
        return doubleColl.toArray(new Double[doubleColl.size()]);
    }
}

Related

  1. toClassArray(Collection> collection)
  2. toClassArray(final Collection collection)
  3. toDouble(final Collection numbers)
  4. toDoubleArray(Collection items)
  5. toDoubleArray(Collection ds)
  6. toFloatArray(Collection collection)
  7. toFloatArray(Collection c)
  8. toFloatArray(Collection array)
  9. toFloatArray(final Collection c)