(int index, int size, String desc)
| 1247 | } |
| 1248 | |
| 1249 | private static String badElementIndex(int index, int size, String desc) { |
| 1250 | if (index < 0) { |
| 1251 | return format("%s (%s) must not be negative", desc, index); |
| 1252 | } else if (size < 0) { |
| 1253 | throw new IllegalArgumentException("negative size: " + size); |
| 1254 | } else { // index >= size |
| 1255 | return format("%s (%s) must be less than size (%s)", desc, index, size); |
| 1256 | } |
| 1257 | } |
| 1258 | |
| 1259 | /** |
| 1260 | * Ensures that {@code index} specifies a valid <i>position</i> in an array, list or string of |
no test coverage detected