Android Utililty Methods Array Clone

List of utility methods to do Array Clone

Description

The list of methods to do Array Clone are organized into topic(s).

Method

T[]clone(T[] 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.

if (array == null) {
    return null;
return array.clone();
boolean[]clone(boolean[] array)

Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

if (array == null) {
    return null;
return array.clone();
byte[]clone(byte[] array)

Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

if (array == null) {
    return null;
return array.clone();
byte[]clone(byte[] data)
clone
if (data == null) {
    return null;
byte[] copy = new byte[data.length];
System.arraycopy(data, 0, copy, 0, data.length);
return copy;
char[]clone(char[] array)

Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

if (array == null) {
    return null;
return array.clone();
double[]clone(double[] array)

Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

if (array == null) {
    return null;
return array.clone();
float[]clone(float[] array)

Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

if (array == null) {
    return null;
return array.clone();
int[]clone(int[] array)

Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

if (array == null) {
    return null;
return array.clone();
int[]clone(int[] data)
clone
if (data == null) {
    return null;
int[] copy = new int[data.length];
System.arraycopy(data, 0, copy, 0, data.length);
return copy;
long[]clone(long[] array)

Clones an array returning a typecast result and handling null.

This method returns null for a null input array.

if (array == null) {
    return null;
return array.clone();