IntegerSequence.Range (Apache Commons Math 3.6.1 API)

org.apache.commons.math3.util

## Class IntegerSequence.Range

- java.lang.Object
- - org.apache.commons.math3.util.IntegerSequence.Range

- All Implemented Interfaces:
    Iterable<Integer>
  Enclosing class:
    IntegerSequence

      public static class IntegerSequence.Range
      extends Object
      implements Iterable<Integer>

  Generates a sequence of integers.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IntegerSequence.Range(int start, int max, int step)` Creates a sequence \( a_i, i < 0 <= n \) where \( a_i = start + i * step \) and \( n \) is such that \( a_n <= max \) and \( a_{n+1} > max \).

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Iterator<Integer>` | `iterator()`
    `int` | `size()` Gets the number of elements contained in the range.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IntegerSequence.Range

          public IntegerSequence.Range(int start,
                               int max,
                               int step)

      Creates a sequence \( a_i, i < 0 <= n \) where \( a_i = start + i * step \) and \( n \) is such that \( a_n <= max \) and \( a_{n+1} > max \).
      Parameters:
        `start` - First value of the range.
        `max` - Last value of the range that satisfies the above construction rule.
        `step` - Increment.

  - ### Method Detail

    - #### size

          public int size()

      Gets the number of elements contained in the range.
      Returns:
        the size of the range.

    - #### iterator

          public Iterator<Integer> iterator()

      Specified by:
        `iterator` in interface `Iterable<Integer>`

Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.