Actually, this fix belonged in ListUtil.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1171 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2003-07-15 00:31:54 +00:00
parent 1fd653ce33
commit 46a1a75da0
2 changed files with 9 additions and 11 deletions
@@ -1,5 +1,5 @@
//
// $Id: ListUtil.java,v 1.11 2002/12/12 00:29:39 mdb Exp $
// $Id: ListUtil.java,v 1.12 2003/07/15 00:31:54 ray Exp $
package com.samskivert.util;
@@ -308,11 +308,13 @@ public class ListUtil
protected static int indexOf (
EqualityComparator eqc, Object[] list, Object element)
{
int llength = list.length; // no optimizing bastards
for (int i = 0; i < llength; i++) {
Object elem = list[i];
if (eqc.equals(elem, element)) {
return i;
if (list != null) {
int llength = list.length; // no optimizing bastards
for (int i = 0; i < llength; i++) {
Object elem = list[i];
if (eqc.equals(elem, element)) {
return i;
}
}
}
return -1;
@@ -1,5 +1,5 @@
//
// $Id: SortableArrayList.java,v 1.15 2003/07/15 00:30:30 ray Exp $
// $Id: SortableArrayList.java,v 1.16 2003/07/15 00:31:54 ray Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne
@@ -237,10 +237,6 @@ public class SortableArrayList extends AbstractList
// documentation inherited from interface
public int indexOf (Object o)
{
if (_elements == null) {
return -1;
}
return ListUtil.indexOfEqual(_elements, o);
}