Sdílet prostřednictvím


Objects.CheckIndex Method

Definition

Overloads

CheckIndex(Int32, Int32)

Checks if the index is within the bounds of the range from 0 (inclusive) to length (exclusive).

CheckIndex(Int64, Int64)

Checks if the index is within the bounds of the range from 0 (inclusive) to length (exclusive).

CheckIndex(Int32, Int32)

Checks if the index is within the bounds of the range from 0 (inclusive) to length (exclusive).

[Android.Runtime.Register("checkIndex", "(II)I", "", ApiSince=30)]
public static int CheckIndex (int index, int length);
[<Android.Runtime.Register("checkIndex", "(II)I", "", ApiSince=30)>]
static member CheckIndex : int * int -> int

Parameters

index
Int32

the index

length
Int32

the upper-bound (exclusive) of the range

Returns

index if it is within bounds of the range

Attributes

Remarks

Checks if the index is within the bounds of the range from 0 (inclusive) to length (exclusive).

The index is defined to be out of bounds if any of the following inequalities is true: <ul> <li>index < 0</li> <li>index >= length</li> <li>length < 0, which is implied from the former inequalities</li> </ul>

Added in 9.

Java documentation for java.util.Objects.checkIndex(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

CheckIndex(Int64, Int64)

Checks if the index is within the bounds of the range from 0 (inclusive) to length (exclusive).

[Android.Runtime.Register("checkIndex", "(JJ)J", "", ApiSince=34)]
public static long CheckIndex (long index, long length);
[<Android.Runtime.Register("checkIndex", "(JJ)J", "", ApiSince=34)>]
static member CheckIndex : int64 * int64 -> int64

Parameters

index
Int64

the index

length
Int64

the upper-bound (exclusive) of the range

Returns

index if it is within bounds of the range

Attributes

Remarks

Checks if the index is within the bounds of the range from 0 (inclusive) to length (exclusive).

The index is defined to be out of bounds if any of the following inequalities is true: <ul> <li>index < 0</li> <li>index >= length</li> <li>length < 0, which is implied from the former inequalities</li> </ul>

Added in 16.

Java documentation for java.util.Objects.checkIndex(long, long).

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