Here you can find the source of clone(final T[] array)
null
.Parameter | Description |
---|---|
T | the component type of the array |
array | the array to shallow clone, may be <code>null</code> |
null
public static <T> T[] clone(final T[] array)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w .j a va 2 s . c o m*/ * Shallow clones an array and handling <code>null</code>.<br> * The objects in the array are not cloned, thus there is no special handling for multi-dimensional arrays. * * @param <T> * the component type of the array * @param array * the array to shallow clone, may be <code>null</code> * @return the cloned array or <code>null</code> */ public static <T> T[] clone(final T[] array) { return array != null ? array.clone() : null; } /** * Clones an array and handling <code>null</code>. * * @param array * the array to clone, may be <code>null</code> * @return the cloned array or <code>null</code> */ public static long[] clone(final long[] array) { return array != null ? array.clone() : null; } /** * Clones an array and handling <code>null</code>. * * @param array * the array to clone, may be <code>null</code> * @return the cloned array or <code>null</code> */ public static int[] clone(final int[] array) { return array != null ? array.clone() : null; } /** * Clones an array and handling <code>null</code>. * * @param array * the array to clone, may be <code>null</code> * @return the cloned array or <code>null</code> */ public static short[] clone(final short[] array) { return array != null ? array.clone() : null; } /** * Clones an array and handling <code>null</code>. * * @param array * the array to clone, may be <code>null</code> * @return the cloned array or <code>null</code> */ public static char[] clone(final char[] array) { return array != null ? array.clone() : null; } /** * Clones an array and handling <code>null</code>. * * @param array * the array to clone, may be <code>null</code> * @return the cloned array or <code>null</code> */ public static byte[] clone(final byte[] array) { return array != null ? array.clone() : null; } /** * Clones an array and handling <code>null</code>. * * @param array * the array to clone, may be <code>null</code> * @return the cloned array or <code>null</code> */ public static double[] clone(final double[] array) { return array != null ? array.clone() : null; } /** * Clones an array and handling <code>null</code>. * * @param array * the array to clone, may be <code>null</code> * @return the cloned array or <code>null</code> */ public static float[] clone(final float[] array) { return array != null ? array.clone() : null; } /** * Clones an array and handling <code>null</code>. * * @param array * the array to clone, may be <code>null</code> * @return the cloned array or <code>null</code> */ public static boolean[] clone(final boolean[] array) { return array != null ? array.clone() : null; } }