apidoc: indexOf uses binary search if list is sorted
This commit is contained in:
@@ -541,10 +541,13 @@ public final class IntList implements Serializable, Cloneable {
|
||||
/**
|
||||
* Returns the index of the first occurrence of {@code value}, or -1 if it does
|
||||
* not exist.
|
||||
* <p>
|
||||
* This method uses a binary search algorithm if the list is sorted.
|
||||
*
|
||||
* @param value
|
||||
* the value
|
||||
* @return the index, or -1
|
||||
* @see #isSorted()
|
||||
*/
|
||||
public int indexOf(final int value) {
|
||||
return indexOf(value, 0);
|
||||
@@ -553,6 +556,8 @@ public final class IntList implements Serializable, Cloneable {
|
||||
/**
|
||||
* Returns the index of the first occurrence of {@code value} starting at the
|
||||
* {@code offset}'s element, or -1 if it does not exist.
|
||||
* <p>
|
||||
* This method uses a binary search algorithm if the list is sorted.
|
||||
*
|
||||
* @param value
|
||||
* the value
|
||||
@@ -561,6 +566,7 @@ public final class IntList implements Serializable, Cloneable {
|
||||
* @return the index, or -1
|
||||
* @throws ArrayIndexOutOfBoundsException
|
||||
* if offset is negative, or larger than the size of the list
|
||||
* @see #isSorted()
|
||||
*/
|
||||
public int indexOf(final int value, final int offset) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user