Lines Matching defs:key

62      * Gets the boolean mapped from the specified key, or <code>false</code>
65 public boolean get(int key) {
66 return get(key, false);
70 * Gets the boolean mapped from the specified key, or the specified value
73 public boolean get(int key, boolean valueIfKeyNotFound) {
74 int i = binarySearch(mKeys, 0, mSize, key);
84 * Removes the mapping from the specified key, if there was any.
86 public void delete(int key) {
87 int i = binarySearch(mKeys, 0, mSize, key);
97 * Adds a mapping from the specified key to the specified value,
98 * replacing the previous mapping from the specified key if there
101 public void put(int key, boolean value) {
102 int i = binarySearch(mKeys, 0, mSize, key);
129 mKeys[i] = key;
136 * Returns the number of key-value mappings that this SparseBooleanArray
145 * the key from the <code>index</code>th key-value mapping that this
154 * the value from the <code>index</code>th key-value mapping that this
163 * specified key, or a negative number if the specified
164 * key is not mapped.
166 public int indexOfKey(int key) {
167 return binarySearch(mKeys, 0, mSize, key);
172 * specified key, or a negative number if no keys map to the
174 * Beware that this is a linear search, unlike lookups by key,
187 * Removes all key-value mappings from this SparseBooleanArray.
194 * Puts a key/value pair into the array, optimizing for the case where
195 * the key is greater than all existing keys in the array.
197 public void append(int key, boolean value) {
198 if (mSize != 0 && key <= mKeys[mSize - 1]) {
199 put(key, value);
218 mKeys[pos] = key;
223 private static int binarySearch(int[] a, int start, int len, int key) {
229 if (a[guess] < key)
237 else if (a[high] == key)