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

Method get

src/main/java/groovy/lang/NumberRange.java:437–452  ·  view source on GitHub ↗

{@inheritDoc}

(int index)

Source from the content-addressed store, hash-verified

435 * {@inheritDoc}
436 */
437 @Override
438 public Comparable get(int index) {
439 if (index < 0) {
440 throw new IndexOutOfBoundsException("Index: " + index + " should not be negative");
441 }
442 final Iterator<Comparable> iter = new StepIterator(this, stepSize);
443
444 Comparable value = iter.next();
445 for (int i = 0; i < index; i++) {
446 if (!iter.hasNext()) {
447 throw new IndexOutOfBoundsException("Index: " + index + " is too big for range: " + this);
448 }
449 value = iter.next();
450 }
451 return value;
452 }
453
454 /**
455 * 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