This was just plain wrong.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1084 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2003-03-30 02:23:39 +00:00
parent dde9e484cc
commit 200954fd45
@@ -1,5 +1,5 @@
// //
// $Id: SortableArrayList.java,v 1.10 2003/01/18 02:41:19 mdb Exp $ // $Id: SortableArrayList.java,v 1.11 2003/03/30 02:23:39 mdb Exp $
// //
// samskivert library - useful routines for java programs // samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne // Copyright (C) 2001 Michael Bayne
@@ -216,8 +216,11 @@ public class SortableArrayList extends AbstractList
// documentation inherited from interface // documentation inherited from interface
public void add (int index, Object element) public void add (int index, Object element)
{ {
if (index >= 0 && index < _size) { if (index == _size) {
_elements[index] = element; add(element);
} else if (index >= 0 && index < _size) {
_elements = ListUtil.insert(_elements, index, element);
_size++;
} else { } else {
throw new IndexOutOfBoundsException(); throw new IndexOutOfBoundsException();
} }