Made the rangeCheck logic a bit easier for humans to parse.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1180 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: SortableArrayList.java,v 1.17 2003/07/29 23:44:14 ray Exp $
|
// $Id: SortableArrayList.java,v 1.18 2003/07/29 23:50:07 ray 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
|
||||||
@@ -240,7 +240,7 @@ public class SortableArrayList extends AbstractList
|
|||||||
*/
|
*/
|
||||||
protected void rangeCheck (int index, boolean insert)
|
protected void rangeCheck (int index, boolean insert)
|
||||||
{
|
{
|
||||||
if ((index < 0) || (index > _size) || (!insert && index == _size)) {
|
if ((index < 0) || (insert ? (index > _size) : (index >= _size))) {
|
||||||
throw new IndexOutOfBoundsException(
|
throw new IndexOutOfBoundsException(
|
||||||
"Index: " + index + ", Size: " + _size);
|
"Index: " + index + ", Size: " + _size);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user