Don't freak out if we were constructed with an initial capacity of

zero (or a zero-length array) and we need to grow.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2555 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray.j.greenwell
2009-05-08 21:50:17 +00:00
parent 2f7e060653
commit ee688973dd
@@ -122,8 +122,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
}
// does not correctly return IllegalStateException if
// remove() is called twice in a row...
System.arraycopy(_values, _pos, _values, _pos - 1,
_size - _pos);
System.arraycopy(_values, _pos, _values, _pos - 1, _size - _pos);
_pos--;
_values[--_size] = 0;
}
@@ -211,7 +210,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
int valen = _values.length;
int[] source = _values;
if (valen == _size) {
_values = new int[valen*2];
_values = new int[Math.max(DEFAULT_CAPACITY, valen*2)];
System.arraycopy(source, 0, _values, 0, index);
}