diff --git a/src/java/com/samskivert/util/ArrayIntSet.java b/src/java/com/samskivert/util/ArrayIntSet.java index 519f08db..2aae648e 100644 --- a/src/java/com/samskivert/util/ArrayIntSet.java +++ b/src/java/com/samskivert/util/ArrayIntSet.java @@ -196,23 +196,23 @@ public class ArrayIntSet extends AbstractIntSet public boolean remove (int value) { int index = binarySearch(value); - if (index >= 0) { - _size--; - if ((_values.length > DEFAULT_CAPACITY) && (_size < _values.length/8)) { - // if we're using less than 1/8 of our capacity, shrink by half - int[] newVals = new int[_values.length/2]; - System.arraycopy(_values, 0, newVals, 0, index); - System.arraycopy(_values, index+1, newVals, index, _size-index); - _values = newVals; - - } else { - // shift entries past the removed one downwards - System.arraycopy(_values, index+1, _values, index, _size-index); - _values[_size] = 0; - } - return true; + if (index < 0) { + return false; } - return false; + _size--; + if ((_values.length > DEFAULT_CAPACITY) && (_size < _values.length/8)) { + // if we're using less than 1/8 of our capacity, shrink by half + int[] newVals = new int[_values.length/2]; + System.arraycopy(_values, 0, newVals, 0, index); + System.arraycopy(_values, index+1, newVals, index, _size-index); + _values = newVals; + + } else { + // shift entries past the removed one downwards + System.arraycopy(_values, index+1, _values, index, _size-index); + //_values[_size] = 0; + } + return true; } // from interface IntSet @@ -239,7 +239,7 @@ public class ArrayIntSet extends AbstractIntSet // remove() is called twice in a row... System.arraycopy(_values, _pos, _values, _pos - 1, _size - _pos); _pos--; - _values[--_size] = 0; + _size--; //_values[--_size] = 0; } protected int _pos;