Java Object to Long castToLongArray(Object[] array)

Here you can find the source of castToLongArray(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 Long[] castToLongArray(Object[] array) 

Method Source Code

//package com.java2s;
/*/*  w  ww  .  j  av a2s .c  om*/
 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 Long[] castToLongArray(Object[] array) {
        if (array != null) {
            Long[] retArray = new Long[array.length];
            int i = 0;
            for (Object element : array) {
                retArray[i] = element == null ? null : (Long) element;
                i++;
            }
            return retArray;
        }
        return null;
    }
}

Related

  1. castLongtoUInt(long x)
  2. castToLong(final String uid)
  3. castToLong(Object object)
  4. castToLong(Object value)
  5. castToLong(Object value)
  6. objectToLong(Object obj)
  7. objectToPostiveLong(Object object)
  8. objectToShort(Object o)
  9. objectToShort(Object p1)