another bugfix
[org.ibex.util.git] / src / org / ibex / util / Basket.java
index bd981b6..baee97c 100644 (file)
@@ -76,9 +76,11 @@ public interface Basket extends Serializable {
             o[i] = obj; size++;
         }
         public Object set(int i, Object obj) {
-            if (i >= size) throw new IndexOutOfBoundsException(
+            if (i >= o.length) throw new IndexOutOfBoundsException(
                 "index "+i+" is beyond list boundary "+size);
-            Object old = o[i]; o[i] = obj; return old;
+            Object old = o[i]; o[i] = obj;
+           size = Math.max(i+1, size);
+           return old;
         }
         public Object get(int i) {
             if (i >= size) throw new IndexOutOfBoundsException(