Microsoft SDK for Java

indexOf

The indexOf method of the IntRanges Class contains the following signatures:

indexOf(int find, int fromRange)
indexOf(int find)

indexOf(int find, int fromRange)

Searches from a starting index for a range pair containing a given a number. This method sorts but does not condense the ranges.

Syntax

public synchronized int indexOf(int find, int fromRange);

Exceptions

Throws ArrayIndexOutOfBoundsException if the index is less than zero or equal to or greater than the array size.

Return Value

Returns the index of the range pair that includes the number if found; otherwise, returns -1.

Parameters

find The number to search for.
fromRange The index of the range pair to start the search from.

indexOf(int find)

Searches from the beginning for a range pair containing a given number. This method sorts but does not condense the ranges.

Syntax

public int indexOf(int find);

Return Value

Retuens the index of the range pair that includes the number (if found); otherwise, returns -1.

Parameters

find The number to search for.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.