/** * Finds the index of the next non-null key. If the map is empty, -1 will be returned. * * @param start * Index to start at * @return Index of next non-null key */ private int nextKey(final int start) { int i = start; do { if (keys[i] != null) { return i; } i = nextIndex(i); } while (i != start); return -1; }
/** * Finds the index of the next non-null key. If the map is empty, -1 will be returned. * * @param start * Index to start at * @return Index of next non-null key */ private int nextKey(final int start) { int i = start; do { if (keys[i] != null) { return i; } i = nextIndex(i); } while (i != start); return -1; }
/** * Finds the index of the next null key. If no null key can be found, the map is full and -1 * will be returned. * * @param start * Index to start at * @return Index of next null key */ private int nextNullKey(final int start) { int i = start; do { if (keys[i] == null) { return i; } i = nextIndex(i); } while (i != start); return -1; }
/** * Finds the index of the next non-null key. If the map is empty, -1 will be returned. * * @param start * Index to start at * @return Index of next non-null key */ private int nextKey(final int start) { int i = start; do { if (keys[i] != null) { return i; } i = nextIndex(i); } while (i != start); return -1; }
/** * Finds the index of the next null key. If no null key can be found, the map is full and -1 * will be returned. * * @param start * Index to start at * @return Index of next null key */ private int nextNullKey(final int start) { int i = start; do { if (keys[i] == null) { return i; } i = nextIndex(i); } while (i != start); return -1; }
/** * Finds the index of the next null key. If no null key can be found, the map is full and -1 * will be returned. * * @param start * Index to start at * @return Index of next null key */ private int nextNullKey(final int start) { int i = start; do { if (keys[i] == null) { return i; } i = nextIndex(i); } while (i != start); return -1; }
/** * Searches for a key from a given starting index. * * @param key * The key to find in this map * @param start * Index to start at * @return Index of matching key or -1 if not found */ private int findKey(final int start, final Object key) { int i = start; do { if (key.equals(keys[i])) { return i; } i = nextIndex(i); } while (i != start); return -1; }
/** * Searches for a key from a given starting index. * * @param key * The key to find in this map * @param start * Index to start at * @return Index of matching key or -1 if not found */ private int findKey(final int start, final Object key) { int i = start; do { if (key.equals(keys[i])) { return i; } i = nextIndex(i); } while (i != start); return -1; }
/** * Searches for a value from a given starting index. * * @param start * Index to start at * @param value * The value to find in this map * @return Index of matching value or -1 if not found */ private int findValue(final int start, final Object value) { int i = start; do { if (value.equals(values[i])) { return i; } i = nextIndex(i); } while (i != start); return -1; } }
/** * Searches for a key from a given starting index. * * @param key * The key to find in this map * @param start * Index to start at * @return Index of matching key or -1 if not found */ private int findKey(final int start, final Object key) { int i = start; do { if (key.equals(keys[i])) { return i; } i = nextIndex(i); } while (i != start); return -1; }
/** * Searches for a value from a given starting index. * * @param start * Index to start at * @param value * The value to find in this map * @return Index of matching value or -1 if not found */ private int findValue(final int start, final Object value) { int i = start; do { if (value.equals(values[i])) { return i; } i = nextIndex(i); } while (i != start); return -1; } }
/** * Searches for a value from a given starting index. * * @param start * Index to start at * @param value * The value to find in this map * @return Index of matching value or -1 if not found */ private int findValue(final int start, final Object value) { int i = start; do { if (value.equals(values[i])) { return i; } i = nextIndex(i); } while (i != start); return -1; } }
/** * Finds a key by starting at lastSearchIndex and searching from there. If the key is found, * lastSearchIndex is advanced so the next key search can find the next key in the array, which * is the most likely to be retrieved. * * @param key * Key to find in map * @return Index of matching key or -1 if not found */ private int findKey(final Object key) { if (size > 0) { // Find key starting at search index final int index = findKey(lastSearchIndex, key); // Found match? if (index != -1) { // Start search at the next index next time lastSearchIndex = nextIndex(index); // Return index of key return index; } } return -1; }
/** * Finds a key by starting at lastSearchIndex and searching from there. If the key is found, * lastSearchIndex is advanced so the next key search can find the next key in the array, which * is the most likely to be retrieved. * * @param key * Key to find in map * @return Index of matching key or -1 if not found */ private int findKey(final Object key) { if (size > 0) { // Find key starting at search index final int index = findKey(lastSearchIndex, key); // Found match? if (index != -1) { // Start search at the next index next time lastSearchIndex = nextIndex(index); // Return index of key return index; } } return -1; }
/** * Finds a key by starting at lastSearchIndex and searching from there. If the key is found, * lastSearchIndex is advanced so the next key search can find the next key in the array, which * is the most likely to be retrieved. * * @param key * Key to find in map * @return Index of matching key or -1 if not found */ private int findKey(final Object key) { if (size > 0) { // Find key starting at search index final int index = findKey(lastSearchIndex, key); // Found match? if (index != -1) { // Start search at the next index next time lastSearchIndex = nextIndex(index); // Return index of key return index; } } return -1; }
lastSearchIndex = nextIndex(nullIndex); keys[nullIndex] = key; values[nullIndex] = value;
lastSearchIndex = nextIndex(nullIndex); keys[nullIndex] = key; values[nullIndex] = value;
lastSearchIndex = nextIndex(nullIndex); keys[nullIndex] = key; values[nullIndex] = value;