Lines Matching refs:key

48      * Gets the Object mapped from the specified key, or <code>null</code>
51 public E get(int key) {
52 return get(key, null);
56 * Gets the Object mapped from the specified key, or the specified Object
59 public E get(int key, E valueIfKeyNotFound) {
60 int i = binarySearch(mKeys, 0, mSize, key);
70 * Removes the mapping from the specified key, if there was any.
72 public void delete(int key) {
73 int i = binarySearch(mKeys, 0, mSize, key);
86 public void remove(int key) {
87 delete(key);
141 * Adds a mapping from the specified key to the specified value,
142 * replacing the previous mapping from the specified key if there
145 public void put(int key, E value) {
146 int i = binarySearch(mKeys, 0, mSize, key);
154 mKeys[i] = key;
163 i = ~binarySearch(mKeys, 0, mSize, key);
186 mKeys[i] = key;
193 * Returns the number of key-value mappings that this SparseArray
206 * the key from the <code>index</code>th key-value mapping that this
219 * the value from the <code>index</code>th key-value mapping that this
232 * value for the <code>index</code>th key-value mapping that this
245 * specified key, or a negative number if the specified
246 * key is not mapped.
248 public int indexOfKey(int key) {
253 return binarySearch(mKeys, 0, mSize, key);
258 * specified key, or a negative number if no keys map to the
260 * Beware that this is a linear search, unlike lookups by key,
277 * Removes all key-value mappings from this SparseArray.
292 * Puts a key/value pair into the array, optimizing for the case where
293 * the key is greater than all existing keys in the array.
295 public void append(int key, E value) {
296 if (mSize != 0 && key <= mKeys[mSize - 1]) {
297 put(key, value);
320 mKeys[pos] = key;
325 private static int binarySearch(int[] a, int start, int len, int key) {
331 if (a[guess] < key)
339 else if (a[high] == key)