public static LongStreamEx rangeClosed(long startInclusive, long endInclusive, long step) {
        if (step == 0)
            throw new IllegalArgumentException("step = 0");
        if (step == 1)
            return seq(LongStream.rangeClosed(startInclusive, endInclusive));
        if (step == -1) {
            // Handled specially as number of elements can exceed
            // Long.MAX_VALUE
            long sum = endInclusive + startInclusive;
            return seq(LongStream.rangeClosed(endInclusive, startInclusive).map(x -> sum - x));
        }
        if ((endInclusive > startInclusive ^ step > 0) || endInclusive == startInclusive)
            return empty();
        long limit = (endInclusive - startInclusive) * Long.signum(step);
        limit = Long.divideUnsigned(limit, Math.abs(step));
        return seq(LongStream.rangeClosed(0, limit).map(x -> x * step + startInclusive));
    }
public static LongStreamEx rangeClosed ( long startInclusive , long endInclusive , long step ) { if ( step == 0 ) throw new IllegalArgumentException ( "step = 0" ) ; if ( step == 1 ) return seq ( LongStream . rangeClosed ( startInclusive , endInclusive ) ) ; if ( step == - 1 ) { long sum = endInclusive + startInclusive ; return seq ( LongStream . rangeClosed ( endInclusive , startInclusive ) . map ( x -> sum - x ) ) ; } if ( ( endInclusive > startInclusive ^ step > 0 ) || endInclusive == startInclusive ) return empty ( ) ; long limit = ( endInclusive - startInclusive ) * Long . signum ( step ) ; limit = Long . divideUnsigned ( limit , Math . abs ( step ) ) ; return seq ( LongStream . rangeClosed ( 0 , limit ) . map ( x -> x * step + startInclusive ) ) ; }
Returns a sequential ordered {@code LongStreamEx} from
{@code startInclusive} (inclusive) to {@code endInclusive} (inclusive) by
the specified incremental step. The negative step values are also
supported. In this case the {@code startInclusive} should be greater than
{@code endInclusive}.

<p>
Note that depending on the step value the {@code endInclusive} bound may
still not be reached. For example
{@code LongStreamEx.rangeClosed(0, 5, 2)} will yield the stream of three
numbers: 0L, 2L and 4L.

@param startInclusive the (inclusive) initial value
@param endInclusive the inclusive upper bound
@param step the non-zero value which designates the difference between
the consecutive values of the resulting stream.
@return a sequential {@code LongStreamEx} for the range of {@code long}
elements
@throws IllegalArgumentException if step is zero
@see LongStreamEx#rangeClosed(long, long)
@since 0.4.0