{@inheritDoc}
(int index)
| 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 |