Arrays.CopyOf Method

Definition

Overloads

CopyOf(Object[], Int32, Class)

Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length.

CopyOf(Single[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

CopyOf(Int64[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

CopyOf(Int32[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

CopyOf(Int16[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

CopyOf(Byte[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

CopyOf(Char[], Int32)

Copies the specified array, truncating or padding with null characters (if necessary) so the copy has the specified length.

CopyOf(Boolean[], Int32)

Copies the specified array, truncating or padding with false (if necessary) so the copy has the specified length.

CopyOf(Object[], Int32)

Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length.

CopyOf(Double[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

CopyOf(Object[], Int32, Class)

Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length.

[Android.Runtime.Register("copyOf", "([Ljava/lang/Object;ILjava/lang/Class;)[Ljava/lang/Object;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T", "U" })]
public static Java.Lang.Object[] CopyOf (Java.Lang.Object[] original, int newLength, Java.Lang.Class newType);
[<Android.Runtime.Register("copyOf", "([Ljava/lang/Object;ILjava/lang/Class;)[Ljava/lang/Object;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T", "U" })>]
static member CopyOf : Java.Lang.Object[] * int * Java.Lang.Class -> Java.Lang.Object[]

Parameters

original
Object[]

the array to be copied

newLength
Int32

the length of the copy to be returned

newType
Class

the class of the copy to be returned

Returns

Object[]

a copy of the original array, truncated or padded with nulls to obtain the specified length

Attributes

Remarks

Java documentation for java.util.Arrays.copyOf(U[], int, java.lang.Class<? extends T[]>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOf(Single[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

[Android.Runtime.Register("copyOf", "([FI)[F", "")]
public static float[] CopyOf (float[] original, int newLength);
[<Android.Runtime.Register("copyOf", "([FI)[F", "")>]
static member CopyOf : single[] * int -> single[]

Parameters

original
Single[]

the array to be copied

newLength
Int32

the length of the copy to be returned

Returns

Single[]

a copy of the original array, truncated or padded with zeros to obtain the specified length

Attributes

Exceptions

if original == null

Remarks

Java documentation for java.util.Arrays.copyOf(float[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOf(Int64[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

[Android.Runtime.Register("copyOf", "([JI)[J", "")]
public static long[] CopyOf (long[] original, int newLength);
[<Android.Runtime.Register("copyOf", "([JI)[J", "")>]
static member CopyOf : int64[] * int -> int64[]

Parameters

original
Int64[]

the array to be copied

newLength
Int32

the length of the copy to be returned

Returns

Int64[]

a copy of the original array, truncated or padded with zeros to obtain the specified length

Attributes

Exceptions

if original == null

Remarks

Java documentation for java.util.Arrays.copyOf(long[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOf(Int32[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

[Android.Runtime.Register("copyOf", "([II)[I", "")]
public static int[] CopyOf (int[] original, int newLength);
[<Android.Runtime.Register("copyOf", "([II)[I", "")>]
static member CopyOf : int[] * int -> int[]

Parameters

original
Int32[]

the array to be copied

newLength
Int32

the length of the copy to be returned

Returns

Int32[]

a copy of the original array, truncated or padded with zeros to obtain the specified length

Attributes

Exceptions

if original == null

Remarks

Java documentation for java.util.Arrays.copyOf(int[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOf(Int16[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

[Android.Runtime.Register("copyOf", "([SI)[S", "")]
public static short[] CopyOf (short[] original, int newLength);
[<Android.Runtime.Register("copyOf", "([SI)[S", "")>]
static member CopyOf : int16[] * int -> int16[]

Parameters

original
Int16[]

the array to be copied

newLength
Int32

the length of the copy to be returned

Returns

Int16[]

a copy of the original array, truncated or padded with zeros to obtain the specified length

Attributes

Exceptions

if original == null

Remarks

Java documentation for java.util.Arrays.copyOf(short[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOf(Byte[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

[Android.Runtime.Register("copyOf", "([BI)[B", "")]
public static byte[] CopyOf (byte[] original, int newLength);
[<Android.Runtime.Register("copyOf", "([BI)[B", "")>]
static member CopyOf : byte[] * int -> byte[]

Parameters

original
Byte[]

the array to be copied

newLength
Int32

the length of the copy to be returned

Returns

Byte[]

a copy of the original array, truncated or padded with zeros to obtain the specified length

Attributes

Exceptions

if original == null

Remarks

Java documentation for java.util.Arrays.copyOf(byte[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOf(Char[], Int32)

Copies the specified array, truncating or padding with null characters (if necessary) so the copy has the specified length.

[Android.Runtime.Register("copyOf", "([CI)[C", "")]
public static char[] CopyOf (char[] original, int newLength);
[<Android.Runtime.Register("copyOf", "([CI)[C", "")>]
static member CopyOf : char[] * int -> char[]

Parameters

original
Char[]

the array to be copied

newLength
Int32

the length of the copy to be returned

Returns

Char[]

a copy of the original array, truncated or padded with null characters to obtain the specified length

Attributes

Exceptions

if original == null

Remarks

Java documentation for java.util.Arrays.copyOf(char[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOf(Boolean[], Int32)

Copies the specified array, truncating or padding with false (if necessary) so the copy has the specified length.

[Android.Runtime.Register("copyOf", "([ZI)[Z", "")]
public static bool[] CopyOf (bool[] original, int newLength);
[<Android.Runtime.Register("copyOf", "([ZI)[Z", "")>]
static member CopyOf : bool[] * int -> bool[]

Parameters

original
Boolean[]

the array to be copied

newLength
Int32

the length of the copy to be returned

Returns

Boolean[]

a copy of the original array, truncated or padded with false elements to obtain the specified length

Attributes

Exceptions

if original == null

Remarks

Java documentation for java.util.Arrays.copyOf(boolean[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOf(Object[], Int32)

Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length.

[Android.Runtime.Register("copyOf", "([Ljava/lang/Object;I)[Ljava/lang/Object;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Lang.Object[] CopyOf (Java.Lang.Object[] original, int newLength);
[<Android.Runtime.Register("copyOf", "([Ljava/lang/Object;I)[Ljava/lang/Object;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member CopyOf : Java.Lang.Object[] * int -> Java.Lang.Object[]

Parameters

original
Object[]

the array to be copied

newLength
Int32

the length of the copy to be returned

Returns

Object[]

a copy of the original array, truncated or padded with nulls to obtain the specified length

Attributes

Remarks

Java documentation for java.util.Arrays.copyOf(T[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CopyOf(Double[], Int32)

Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length.

[Android.Runtime.Register("copyOf", "([DI)[D", "")]
public static double[] CopyOf (double[] original, int newLength);
[<Android.Runtime.Register("copyOf", "([DI)[D", "")>]
static member CopyOf : double[] * int -> double[]

Parameters

original
Double[]

the array to be copied

newLength
Int32

the length of the copy to be returned

Returns

Double[]

a copy of the original array, truncated or padded with zeros to obtain the specified length

Attributes

Exceptions

if original == null

Remarks

Java documentation for java.util.Arrays.copyOf(double[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to