Lines Matching defs:key

67      * Gets the Object mapped from the specified key, or <code>null</code>
70 public E get(long key) {
71 return get(key, null);
75 * Gets the Object mapped from the specified key, or the specified Object
79 public E get(long key, E valueIfKeyNotFound) {
80 int i = binarySearch(mKeys, 0, mSize, key);
90 * Removes the mapping from the specified key, if there was any.
92 public void delete(long key) {
93 int i = binarySearch(mKeys, 0, mSize, key);
106 public void remove(long key) {
107 delete(key);
149 * Adds a mapping from the specified key to the specified value,
150 * replacing the previous mapping from the specified key if there
153 public void put(long key, E value) {
154 int i = binarySearch(mKeys, 0, mSize, key);
162 mKeys[i] = key;
171 i = ~binarySearch(mKeys, 0, mSize, key);
194 mKeys[i] = key;
201 * Returns the number of key-value mappings that this LongSparseArray
214 * the key from the <code>index</code>th key-value mapping that this
227 * the value from the <code>index</code>th key-value mapping that this
241 * value for the <code>index</code>th key-value mapping that this
254 * specified key, or a negative number if the specified
255 * key is not mapped.
257 public int indexOfKey(long key) {
262 return binarySearch(mKeys, 0, mSize, key);
267 * specified key, or a negative number if no keys map to the
269 * Beware that this is a linear search, unlike lookups by key,
286 * Removes all key-value mappings from this LongSparseArray.
301 * Puts a key/value pair into the array, optimizing for the case where
302 * the key is greater than all existing keys in the array.
304 public void append(long key, E value) {
305 if (mSize != 0 && key <= mKeys[mSize - 1]) {
306 put(key, value);
329 mKeys[pos] = key;
334 private static int binarySearch(long[] a, int start, int len, long key) {
340 if (a[guess] < key)
348 else if (a[high] == key)