Created
August 23, 2012 22:02
-
-
Save caseycrites/3442540 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns an index for which {@link #valueAt} would return the | |
* specified key, or a negative number if no keys map to the | |
* specified value. | |
* Beware that this is a linear search, unlike lookups by key, | |
* and that multiple keys can map to the same value and this will | |
* find only one of them. | |
*/ | |
public int indexOfValue(E value) { | |
if (mGarbage) { | |
gc(); | |
} | |
for (int i = 0; i < mSize; i++) | |
if (mValues[i] == value) | |
return i; | |
return -1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment