NumericRange

scala.collection.immutable.NumericRange
See theNumericRange companion class
object NumericRange

A companion object for numeric ranges.

Attributes

Companion
class
Source
NumericRange.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

class Exclusive[T](start: T, end: T, step: T)(implicit num: Integral[T]) extends NumericRange[T]

Attributes

Source
NumericRange.scala
Supertypes
class NumericRange[T]
trait Serializable
trait IndexedSeq[T]
trait IndexedSeq[T]
class AbstractSeq[T]
trait Seq[T]
trait SeqOps[T, IndexedSeq, IndexedSeq[T]]
trait Iterable[T]
class AbstractSeq[T]
trait Seq[T]
trait Pure
trait Equals
trait SeqOps[T, IndexedSeq, IndexedSeq[T]]
trait PartialFunction[Int, T]
trait Int -> T
class AbstractIterable[T]
trait Iterable[T]
trait IterableOnce[T]
class Object
trait Matchable
class Any
Show all
class Inclusive[T](start: T, end: T, step: T)(implicit num: Integral[T]) extends NumericRange[T]

Attributes

Source
NumericRange.scala
Supertypes
class NumericRange[T]
trait Serializable
trait IndexedSeq[T]
trait IndexedSeq[T]
class AbstractSeq[T]
trait Seq[T]
trait SeqOps[T, IndexedSeq, IndexedSeq[T]]
trait Iterable[T]
class AbstractSeq[T]
trait Seq[T]
trait Pure
trait Equals
trait SeqOps[T, IndexedSeq, IndexedSeq[T]]
trait PartialFunction[Int, T]
trait Int -> T
class AbstractIterable[T]
trait Iterable[T]
trait IterableOnce[T]
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def apply[T](start: T, end: T, step: T)(implicit num: Integral[T]): Exclusive[T]

Attributes

Source
NumericRange.scala
def count[T](start: T, end: T, step: T, isInclusive: Boolean)(implicit num: Integral[T]): Int

Calculates the number of elements in a range given start, end, step, and whether or not it is inclusive. Throws an exception if step == 0 or the number of elements exceeds the maximum Int.

Calculates the number of elements in a range given start, end, step, and whether or not it is inclusive. Throws an exception if step == 0 or the number of elements exceeds the maximum Int.

Type parameters

T

the numeric type of the range elements, which must have an Integral instance

Value parameters

end

the exclusive or inclusive upper bound, depending on isInclusive

isInclusive

whether end is included in the range

num

the Integral instance used for arithmetic on T

start

the first element of the range

step

the increment between successive elements, must not be zero

Attributes

Source
NumericRange.scala
def inclusive[T](start: T, end: T, step: T)(implicit num: Integral[T]): Inclusive[T]

Attributes

Source
NumericRange.scala