Java Array Clone clone(float[] array)

Here you can find the source of clone(float[] array)

Description

Clones an array returning a typecast result and handling null.

License

Apache License

Parameter

Parameter Description
array the array to clone, may be <code>null</code>

Return

the cloned array, null if null input

Declaration

public static float[] clone(float[] array) 

Method Source Code

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

public class Main {
    /**/*from  w w w .ja  va2 s . com*/
     * <p>
     * Clones an array returning a typecast result and handling
     * <code>null</code>.
     * </p>
     *
     * <p>
     * This method returns <code>null</code> for a <code>null</code> input
     * array.
     * </p>
     * 
     * @param array
     *            the array to clone, may be <code>null</code>
     * @return the cloned array, <code>null</code> if <code>null</code> input
     */
    public static float[] clone(float[] array) {
        if (array == null) {
            return null;
        }
        return (float[]) array.clone();
    }

    /**
     * <p>
     * Clones an array returning a typecast result and handling
     * <code>null</code>.
     * </p>
     *
     * <p>
     * This method returns <code>null</code> for a <code>null</code> input
     * array.
     * </p>
     * 
     * @param array
     *            the array to clone, may be <code>null</code>
     * @return the cloned array, <code>null</code> if <code>null</code> input
     */
    public static Object[] clone(Object[] array) {
        if (array == null) {
            return null;
        }
        return array.clone();
    }
}

Related

  1. clone(final double[][] array)
  2. clone(final int[] original)
  3. clone(final T[] array)
  4. clone(final T[] array)
  5. clone(final T[] array)
  6. clone(float[] f)
  7. clone(float[][] array)
  8. clone(int[] a)
  9. clone(int[] array)