Package groovy.lang

Class NumberRange

    • Constructor Detail

      • NumberRange

        public NumberRange​(T from,
                           U to)
        Creates an inclusive NumberRange with step size 1. Creates a reversed range if from < to.
        Parameters:
        from - the first value in the range
        to - the last value in the range
      • NumberRange

        public NumberRange​(T from,
                           U to,
                           boolean inclusive)
        Creates a new NumberRange with step size 1. Creates a reversed range if from < to.
        Parameters:
        from - start of the range
        to - end of the range
        inclusive - whether the range is inclusive
      • NumberRange

        public NumberRange​(T from,
                           U to,
                           V stepSize)
        Creates an inclusive NumberRange. Creates a reversed range if from < to.
        Parameters:
        from - start of the range
        to - end of the range
        stepSize - the gap between discrete elements in the range
      • NumberRange

        public NumberRange​(T from,
                           U to,
                           V stepSize,
                           boolean inclusive)
        Creates a NumberRange. Creates a reversed range if from < to.
        Parameters:
        from - start of the range
        to - end of the range
        stepSize - the gap between discrete elements in the range
        inclusive - whether the range is inclusive