Here you can find the source of clone(Object[] array)
Shallow clones an array returning a typecast result and handling null
.
The objects in the array are not cloned, thus there is no special handling for multi-dimensional arrays.
This method returns null
for a null
input array.
Parameter | Description |
---|---|
array | the array to shallow clone, may be <code>null</code> |
null
if null
input
public static Object[] clone(Object[] array)
//package com.java2s; //License from project: Apache License public class Main { /**/* ww w. j a v a2 s . c o m*/ * <p>Shallow clones an array returning a typecast result and handling * <code>null</code>.</p> * * <p>The objects in the array are not cloned, thus there is no special handling for multi-dimensional arrays.</p> * * <p>This method returns * <code>null</code> for a * <code>null</code> input array.</p> * * @param array the array to shallow 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 (Object[]) array.clone(); } }