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:
@@ -156,7 +156,11 @@ public class SortableArrayList extends AbstractList
|
|||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public boolean contains (Object o)
|
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
|
// documentation inherited from interface
|
||||||
|
|||||||
Reference in New Issue
Block a user