diff --git a/src/java/com/samskivert/util/BaseArrayList.java b/src/java/com/samskivert/util/BaseArrayList.java index 47bee33d..e8a5e54f 100644 --- a/src/java/com/samskivert/util/BaseArrayList.java +++ b/src/java/com/samskivert/util/BaseArrayList.java @@ -70,16 +70,15 @@ public abstract class BaseArrayList extends AbstractList if (target.length < _size) { target = (T[])Array.newInstance( target.getClass().getComponentType(), _size); - } + } else if (target.length > _size) { + // terminate with null if there is room to spare, per the spec + target[_size] = null; + } // copy the elements if (_elements != null) { System.arraycopy(_elements, 0, target, 0, _size); } - // terminate with null if there is room to spare, per the spec - if (target.length > _size) { - target[_size] = null; - } return target; }