MCPcopy Index your code
hub / github.com/apache/groovy / get

Method get

src/main/java/groovy/lang/ObjectRange.java:255–270  ·  view source on GitHub ↗

{@inheritDoc}

(int index)

Source from the content-addressed store, hash-verified

253 * {@inheritDoc}
254 */
255 @Override
256 public Comparable get(int index) {
257 if (index < 0) {
258 throw new IndexOutOfBoundsException("Index: " + index + " should not be negative");
259 }
260 final StepIterator iter = new StepIterator(this, 1);
261
262 Comparable value = iter.next();
263 for (int i = 0; i < index; i++) {
264 if (!iter.hasNext()) {
265 throw new IndexOutOfBoundsException("Index: " + index + " is too big for range: " + this);
266 }
267 value = iter.next();
268 }
269 return value;
270 }
271
272 /**
273 * Checks whether a value is between the from and to values of a Range

Callers

nothing calls this directly

Calls 2

nextMethod · 0.95
hasNextMethod · 0.95

Tested by

no test coverage detected