scala

class Range

[source: scala/Range.scala]

class Range(val start : Int, val end : Int, val step : Int)
extends Projection[Int]

The Range class represents integer values in range [start;end) with non-zero step value step. Sort of acts like a sequence also (supports length and contains). For example:

     val r1 = 0 until 10
     val r2 = r1.start until r1.end by r1.step + 1
     println(r2.length) // = 5
  
Author
Stephane Micheloud
Version
1.0, 01/05/2007
Direct Known Subclasses:
Range.Inclusive

Value Summary
lazy val length : Int
Returns the length of the sequence.
Method Summary
def apply (idx : Int) : Int
def by (step : Int) : Range
Create a new range with the start and end values of this range and a new step.
def contains (x : Int) : Boolean
a Seq.contains, not a Iterator.contains!
def inclusive : Inclusive
protected def last (base : Int, step : Int) : Int
Methods inherited from Projection
projection, force, map, append
Methods inherited from RandomAccessSeq
elements, drop, take, slice, reverse, patch, ++, toStream, safeIs
Methods inherited from Projection
flatMap, takeWhile, filter
Methods inherited from Seq
lengthCompare, size, isEmpty, concat, last, lastOption, first, firstOption, headOption, isDefinedAt, lastIndexOf, slice, dropWhile, contains, subseq, toArray, toSeq, equalsWith, startsWith, endsWith, indexOf, containsSlice
Methods inherited from Collection
toString, stringPrefix
Methods inherited from Iterable
partition, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, mkString, mkString, mkString, addString, addString, copyToArray, hasDefiniteSize
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from AnyRef
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Value Details
lazy val length : Int
Returns the length of the sequence.
Returns
the sequence length.

Method Details
def by(step : Int) : Range
Create a new range with the start and end values of this range and a new step.

protected def last(base : Int, step : Int) : Int

def apply(idx : Int) : Int

def contains(x : Int) : Boolean
a Seq.contains, not a Iterator.contains!

def inclusive : Inclusive