Stores the specified key and returns its index, or returns the negative index if the key has already been stored. @param key key to be indexed @return index, or negative index if the key already exists
(final int key)
| 86 | * @return index, or negative index if the key already exists |
| 87 | */ |
| 88 | private int store(final int key) { |
| 89 | int b = key & capacity() - 1; |
| 90 | for(int i = buckets[b]; i != 0; i = next[i]) { |
| 91 | if(key == keys[i]) return -i; |
| 92 | } |
| 93 | final int s = size++; |
| 94 | if(checkCapacity()) b = key & capacity() - 1; |
| 95 | next[s] = buckets[b]; |
| 96 | keys[s] = key; |
| 97 | buckets[b] = s; |
| 98 | return s; |
| 99 | } |
| 100 | |
| 101 | @Override |
| 102 | protected final int hashCode(final int index) { |
no test coverage detected