apidoc: indexOf uses binary search if list is sorted

This commit is contained in:
2017-12-03 09:13:02 +01:00
parent 63c7740fd6
commit b7ef9d2e6f

View File

@@ -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 * Returns the index of the first occurrence of {@code value}, or -1 if it does
* not exist. * not exist.
* <p>
* This method uses a binary search algorithm if the list is sorted.
* *
* @param value * @param value
* the value * the value
* @return the index, or -1 * @return the index, or -1
* @see #isSorted()
*/ */
public int indexOf(final int value) { public int indexOf(final int value) {
return indexOf(value, 0); 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 * Returns the index of the first occurrence of {@code value} starting at the
* {@code offset}'s element, or -1 if it does not exist. * {@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 * @param value
* the value * the value
@@ -561,6 +566,7 @@ public final class IntList implements Serializable, Cloneable {
* @return the index, or -1 * @return the index, or -1
* @throws ArrayIndexOutOfBoundsException * @throws ArrayIndexOutOfBoundsException
* if offset is negative, or larger than the size of the list * if offset is negative, or larger than the size of the list
* @see #isSorted()
*/ */
public int indexOf(final int value, final int offset) { public int indexOf(final int value, final int offset) {