Lines Matching refs:key

69      * Gets the Object mapped from the specified key, or <code>null</code>
72 public E get(int key) {
73 return get(key, null);
77 * Gets the Object mapped from the specified key, or the specified Object
80 public E get(int key, E valueIfKeyNotFound) {
81 int i = binarySearch(mKeys, 0, mSize, key);
91 * Removes the mapping from the specified key, if there was any.
93 public void delete(int key) {
94 int i = binarySearch(mKeys, 0, mSize, key);
107 public void remove(int key) {
108 delete(key);
159 * Adds a mapping from the specified key to the specified value,
160 * replacing the previous mapping from the specified key if there
163 public void put(int key, E value) {
164 int i = binarySearch(mKeys, 0, mSize, key);
172 mKeys[i] = key;
181 i = ~binarySearch(mKeys, 0, mSize, key);
204 mKeys[i] = key;
211 * Returns the number of key-value mappings that this SparseArray
224 * the key from the <code>index</code>th key-value mapping that this
237 * the value from the <code>index</code>th key-value mapping that this
250 * value for the <code>index</code>th key-value mapping that this
263 * specified key, or a negative number if the specified
264 * key is not mapped.
266 public int indexOfKey(int key) {
271 return binarySearch(mKeys, 0, mSize, key);
276 * specified key, or a negative number if no keys map to the
278 * Beware that this is a linear search, unlike lookups by key,
295 * Removes all key-value mappings from this SparseArray.
310 * Puts a key/value pair into the array, optimizing for the case where
311 * the key is greater than all existing keys in the array.
313 public void append(int key, E value) {
314 if (mSize != 0 && key <= mKeys[mSize - 1]) {
315 put(key, value);
338 mKeys[pos] = key;
353 private static int binarySearch(int[] a, int start, int len, int key) {
359 if (a[guess] < key)
367 else if (a[high] == key)