A slightly more subtle version of contains() so that it does the

right thing if null is passed in.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1520 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2008-08-25 06:55:08 +00:00
parent de5c77ca81
commit 42f7a5b962
@@ -156,7 +156,11 @@ public class SortableArrayList extends AbstractList
// documentation inherited from interface
public boolean contains (Object o)
{
return ListUtil.contains(_elements, o);
// we can't use ListUtil.contains() because our _elements
// array is larger than _size and we want to do the right thing
// if null is passed in.
int dex = ListUtil.indexOf(_elements, o);
return (dex >= 0 && dex < _size);
}
// documentation inherited from interface