Lines Matching defs:key

66      * Gets the int mapped from the specified key, or <code>0</code>
69 public int get(int key) {
70 return get(key, 0);
74 * Gets the int mapped from the specified key, or the specified value
77 public int get(int key, int valueIfKeyNotFound) {
78 int i = binarySearch(mKeys, 0, mSize, key);
88 * Removes the mapping from the specified key, if there was any.
90 public void delete(int key) {
91 int i = binarySearch(mKeys, 0, mSize, key);
108 * Adds a mapping from the specified key to the specified value,
109 * replacing the previous mapping from the specified key if there
112 public void put(int key, int value) {
113 int i = binarySearch(mKeys, 0, mSize, key);
140 mKeys[i] = key;
147 * Returns the number of key-value mappings that this SparseIntArray
156 * the key from the <code>index</code>th key-value mapping that this
165 * the value from the <code>index</code>th key-value mapping that this
174 * specified key, or a negative number if the specified
175 * key is not mapped.
177 public int indexOfKey(int key) {
178 return binarySearch(mKeys, 0, mSize, key);
183 * specified key, or a negative number if no keys map to the
185 * Beware that this is a linear search, unlike lookups by key,
198 * Removes all key-value mappings from this SparseIntArray.
205 * Puts a key/value pair into the array, optimizing for the case where
206 * the key is greater than all existing keys in the array.
208 public void append(int key, int value) {
209 if (mSize != 0 && key <= mKeys[mSize - 1]) {
210 put(key, value);
229 mKeys[pos] = key;
234 private static int binarySearch(int[] a, int start, int len, int key) {
240 if (a[guess] < key)
248 else if (a[high] == key)