Index: runtime/lib/growable_array.dart |
=================================================================== |
--- runtime/lib/growable_array.dart (revision 942) |
+++ runtime/lib/growable_array.dart (working copy) |
@@ -75,9 +75,6 @@ |
// The length of this growable array. It is always less than the |
// length of the backing array. |
int _length; |
- // Constant used by indexOf and lastIndexOf when the element given |
- // is not in the array. |
- static final int ABSENT = -1; |
GrowableObjectArray() |
: _length = 0, backingArray = new ObjectArray<T>(4) {} |
@@ -172,12 +169,13 @@ |
return backingArray[_length - 1]; |
} |
- int indexOf(T element, int startIndex) { |
- return Arrays.indexOf(backingArray, element, startIndex, _length); |
+ int indexOf(T element, [int start = 0]) { |
+ return Arrays.indexOf(backingArray, element, start, _length); |
} |
- int lastIndexOf(T element, int startIndex) { |
- return Arrays.lastIndexOf(backingArray, element, startIndex); |
+ int lastIndexOf(T element, [int start = null]) { |
+ if (start === null) start = length - 1; |
+ return Arrays.lastIndexOf(backingArray, element, start); |
} |
/** |