Range

cats.collections.Range
See theRange companion object
final case class Range[A](start: A, end: A)

Represent an inclusive range [x, y] that can be generated by using discrete operations

Attributes

Companion
object
Source
Range.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def &(other: Range[A])(implicit order: Order[A]): Option[Range[A]]

Attributes

Source
Range.scala
def +(other: Range[A])(implicit order: Order[A], discrete: Discrete[A]): (Range[A], Option[Range[A]])

Attributes

Source
Range.scala
def -(range: Range[A])(implicit discrete: Discrete[A], order: Order[A]): Option[(Range[A], Option[Range[A]])]

Subtract a Range from this range.

Subtract a Range from this range. The result will be 0, 1 or 2 ranges

Attributes

Source
Range.scala
def contains(range: Range[A])(implicit order: Order[A]): Boolean

Verify that the passed range is a sub-range

Verify that the passed range is a sub-range

Attributes

Source
Range.scala
def contains(x: A)(implicit A: Order[A]): Boolean

Verify is x is in range [start, end]

Verify is x is in range [start, end]

Attributes

Source
Range.scala
def foldLeft[B](s: B, f: (B, A) => B)(implicit discrete: Discrete[A], order: Order[A]): B

Folds over the elements of the range from left to right; accumulates a value of type B by applying the function f to the current value and the next element.

Folds over the elements of the range from left to right; accumulates a value of type B by applying the function f to the current value and the next element.

Attributes

Source
Range.scala
def foldRight[B](s: B, f: (A, B) => B)(implicit discrete: Discrete[A], order: Order[A]): B

Folds over the elements of the range from right to left; accumulates a value of type B by applying the function f to the current value and the next element.

Folds over the elements of the range from right to left; accumulates a value of type B by applying the function f to the current value and the next element.

Attributes

Source
Range.scala
def foreach(f: A => Unit)(implicit discrete: Discrete[A], order: Order[A]): Unit

Apply function f to each element in range [star, end].

Apply function f to each element in range [star, end]. Does nothing if end precedes start.

Attributes

Source
Range.scala
def map[B](f: A => B): Range[B]

Attributes

Source
Range.scala
def overlaps(range: Range[A])(implicit order: Order[A]): Boolean

Verify whether or not the passed range overlaps the current range

Verify whether or not the passed range overlaps the current range

Attributes

Source
Range.scala
def reverse: Range[A]

Returns range [end, start]

Returns range [end, start]

Attributes

Source
Range.scala
def toIterator(implicit discrete: Discrete[A], order: Order[A]): Iterator[A]

Return an iterator for the values in the range.

Return an iterator for the values in the range. The iterator moves from start to end taking into consideration the provided ordering. If (start > end) it uses start's predecessor offered by the Discrete instance, otherwise it uses the start's successor.

Attributes

Source
Range.scala
def toList(implicit discrete: Discrete[A], order: Order[A]): List[A]

Return all the values in the Range as a List.

Return all the values in the Range as a List.

Attributes

Source
Range.scala

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product