예제 #1
0
 float removeStash(int key, float defaultValue) {
   int[] keyTable = this.keyTable;
   for (int i = capacity, n = i + stashSize; i < n; i++) {
     if (key == keyTable[i]) {
       float oldValue = valueTable[i];
       removeStashIndex(i);
       size--;
       return oldValue;
     }
   }
   return defaultValue;
 }
예제 #2
0
 public void remove() {
   if (currentIndex == INDEX_ZERO && map.hasZeroValue) {
     map.hasZeroValue = false;
   } else if (currentIndex < 0) {
     throw new IllegalStateException("next must be called before remove.");
   } else if (currentIndex >= map.capacity) {
     map.removeStashIndex(currentIndex);
     nextIndex = currentIndex - 1;
     findNextIndex();
   } else {
     map.keyTable[currentIndex] = EMPTY;
   }
   currentIndex = INDEX_ILLEGAL;
   map.size--;
 }