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