1 19 package gnu.trove; 20 21 import java.util.ConcurrentModificationException; 22 23 90 91 public class TObjectIntIterator extends TIterator { 92 private final TObjectIntHashMap _map; 93 94 public TObjectIntIterator(TObjectIntHashMap map) { 95 super(map); 96 this._map = map; 97 } 98 99 105 protected final int nextIndex() { 106 if (_expectedSize != _hash.size()) { 107 throw new ConcurrentModificationException(); 108 } 109 110 Object[] set = _map._set; 111 int i = _index; 112 while (i-- > 0 && (set[i] == TObjectHash.FREE || set[i] == TObjectHash.REMOVED)) ; 113 return i; 114 } 115 116 121 public void advance() { 122 moveToNextIndex(); 123 } 124 125 132 public Object key() { 133 return _map._set[_index]; 134 } 135 136 143 public int value() { 144 return _map._values[_index]; 145 } 146 147 155 public int setValue(int val) { 156 int old = value(); 157 _map._values[_index] = val; 158 return old; 159 } 160 } | Popular Tags |