|
Authored by: bugstomper on Thursday, April 19 2012 @ 04:23 PM EDT |
That's why I said "functionally equivalent" rather than phrasing it in
a way that implies they are identical.
They both serve the purpose of checking that the start and end indices are in
range, they both throw the exceptions that the API Spec says they should. The
Spec does not explicitly state which of the two exceptions should be thrown if
the start index is less than 0 and the end index is less than the start index,
or if the end index is greater than the array length and the start index is
greater than the array index. Also the spec does not say that you need two
different messages in the out of bounds exceptions to distinguish the start less
than 0 case from the end greater than array length case, or if you can have a
single general message that contains enough information for the developer to
figure out what has happened.
So both implementations satisfy the functional requirements, each in their own
way, which is what I meant by "functionally equivalent".
[ Reply to This | Parent | # ]
|
|
|
|
|