Java Object to Double castToDoubleArray(Object[] array)

Here you can find the source of castToDoubleArray(Object[] array)

Description

EPL has embedded cast method, but it doesn't cover arrays

License

GNU General Public License

Parameter

Parameter Description
array a parameter

Declaration

public static Double[] castToDoubleArray(Object[] array) 

Method Source Code

//package com.java2s;
/*/*from   w ww  . j  a  v a  2 s .c o m*/
 Pulsar
 Copyright (C) 2013-2015 eBay Software Foundation
 Licensed under the GPL v2 license.  See LICENSE for full terms.
 */

public class Main {
    /**
     * EPL has embedded cast method, but it doesn't cover arrays
     * 
     * @param array
     * @return
     */
    public static Double[] castToDoubleArray(Object[] array) {
        if (array != null) {
            Double[] retArray = new Double[array.length];
            int i = 0;
            for (Object element : array) {
                retArray[i] = element == null ? null : (Double) element;
                i++;
            }
            return retArray;
        }
        return null;
    }
}

Related

  1. castDouble(Object o)
  2. castDoubleToFloat(final double v)
  3. castShortToDouble(short[] x)
  4. castToDouble(Object object)
  5. castToDoubleArray(byte[] data)
  6. castToDoubles(final int[] ints)
  7. objectToDouble(Object o)
  8. objectToDouble(Object o)
  9. objectToDouble(Object o)