Scala 2

API Specification
This document is the API specification for Scala 2.


Class Summary
final case class :: [ b ]
A non empty list characterized by a head and a tail.
sealed abstract class All$
Dummy class which exist only to satisfy the JVM. It corresponds to scala.All. If such type appears in method signatures, it is erased to this one.
sealed abstract class AllRef$
Dummy class which exist only to satisfy the JVM. It corresponds to scala.AllRef. If such type appears in method signatures, it is erased to this one.
mixin abstract class Application
The Application class can be used to quickly turn objects into executable programs. Here is an example:
   object Main with Application {
     Console.println("Hello World!");
   }
   
Here, object Main inherits the main method of Application. The body of the Main object defines the main program. This technique does not work if the main program depends on command-line arguments (which are not accessible with the technique presented here). It is possible to time the execution of objects that inherit from class Application by setting the global scala.time property. Here is an example for benchmarking object Main:
   java -Dscala.time Main
   

final class Array [ a ]

class Attribute
A base class for attributes
class BigInt

mixin abstract class BufferedIterator [ A ]
Buffered iterators are iterators which llow to inspect the next element without discarding it.
mixin abstract class CaseClass
defines an access function for instances of case classes
case class Cell [ T ]
A Cell is a generic wrapper which completely hides the functionality of the wrapped object. The wrapped object is accessible via the elem accessor method.
mixin abstract class CountedIterator [ A ]
Counted iterators keep track of the number of elements seen so far
abstract class Enumeration

The class Enumeration provides the same functionality as the enum construct found in C-like languages like C++ or Java. Here is an example:

  object Main with Application {
 
    object WeekDays extends Enumeration  {
      val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
    }
 
    def isWorkingDay(d: WeekDays.Value) =
      ! (d == WeekDays.Sat || d == WeekDays.Sun);
  
    WeekDays filter (isWorkingDay) foreach { d => System.out.println(d) }
  }
  

mixin abstract class Function0 [ R ]
Function with no parameters
mixin abstract class Function1 [ T0 , R ]
Function with 1 parameter
mixin abstract class Function2 [ T0 , T1 , R ]
Function with 2 parameters
mixin abstract class Function3 [ T0 , T1 , T2 , R ]
Function with 3 parameters
mixin abstract class Function4 [ T0 , T1 , T2 , T3 , R ]
Function with 4 parameters
mixin abstract class Function5 [ T0 , T1 , T2 , T3 , T4 , R ]
Function with 5 parameters
mixin abstract class Function6 [ T0 , T1 , T2 , T3 , T4 , T5 , R ]
Function with 6 parameters
mixin abstract class Function7 [ T0 , T1 , T2 , T3 , T4 , T5 , T6 , R ]
Function with 7 parameters
mixin abstract class Function8 [ T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , R ]
Function with 8 parameters
mixin abstract class Function9 [ T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , R ]
Function with 9 parameters
mixin abstract class Iterable [ A ]
Collection classes mixing in this class provide a method elements which returns an iterator over all the elements contained in the collection.
mixin abstract class IterableProxy [ A ]
This class implements a proxy for iterable objects. It forwards all calls to a different iterable object.
mixin abstract class Iterator [ A ]
Iterators are data structures that allow to iterate over a sequence of elements. They have a hasNext method for checking if there is a next element available, and a next method which returns the next element and discards it from the iterator.
sealed abstract class List [ a ]
A class representing an ordered collection of elements of type a. This class comes with two implementing case classes scala.Nil and scala.:: that implement the abstract members isEmpty, head and tail.
final class MatchError

final class NotDefinedError

sealed abstract class Option [ A ]
This class represents optional values. Instances of Option are either instances of case class Some or it is case object None.
mixin abstract class Ordered [ a ]
A class for totally ordered data.
mixin abstract class PartialFunction [ A , B ]
A partial function of type PartialFunction[A, B] is a unary function where the domain does not include all values of type A. The function isDefinedAt allows to test dynamically, if a value is in the domain of the function.
mixin abstract class PartiallyOrdered [ a ]
A class for partially ordered data.
mixin abstract class Proxy
This class implements a simple proxy that forwards all calls to methods of class Any to another object self. Please note that only those methods can be forwarded that are overridable and public.
abstract class Responder [ a ]
instances of responder are the building blocks of small programs written in continuation passing style. By using responder classes in for comprehensions, one can embed domain-specific languages in Scala while giving the impression that programs in these DSLs are written in direct style.
mixin abstract class ScalaObject

mixin abstract class Seq [ A ]
Class Seq[A] represents finite sequences of elements of type A.
mixin abstract class SeqProxy [ A ]
Class Seq[A] represents finite sequences of elements of type A.
case class SerialVersionUID
Attribute for specifying the static SerialVersionUID field of a serializable class
final case class Some [ A ]
Class Some[A] represents existing values of type A.
mixin abstract class Stream [ a ]

The class Stream implements lazy lists where elements are only evaluated when they are needed. Here is an example:

  object Main with Application {
 
    def from(n: Int): Stream[Int] =
      Stream.cons(n, from(n + 1));
 
    def sieve(s: Stream[Int]): Stream[Int] =
      Stream.cons(s.head, sieve(s.tail filter { x => x % s.head != 0 }));
 
    def primes = sieve(from(2));
 
    primes take 10 print
  }
  

final case class Symbol
Instances of Symbol can be created easily with Scala's built-in quote mechanism. For instance, the Scala term 'mysym will invoke the constructor of the Symbol class in the following way: new Symbol("mysym"). .
case class Tuple1 [ T1 ]

case class Tuple2 [ T1 , T2 ]

case class Tuple3 [ T1 , T2 , T3 ]

case class Tuple4 [ T1 , T2 , T3 , T4 ]

case class Tuple5 [ T1 , T2 , T3 , T4 , T5 ]

case class Tuple6 [ T1 , T2 , T3 , T4 , T5 , T6 ]

case class Tuple7 [ T1 , T2 , T3 , T4 , T5 , T6 , T7 ]

case class Tuple8 [ T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ]

case class Tuple9 [ T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ]

class _mixin_
Temporary class. When this appears in the attribute list of an abstract class, the class is assumed to be a mixin. Used to ensure that code that compiles under (old) scalac can also compile under nsc.
class _trait_
Temporary class. When this appears in the attribute list of an abstract class, the class is assumed to be a trait. Used to ensure that code that compiles under (old) scalac can also compile under nsc.
class cloneable
An attribute that designates the class to which it is applied as cloneable
class remote

class serializable
An attribute that designates the class to which it is applied as serializable
class transient

class volatile


Object Summary
object Array

object BigInt

object Console
The Console object implements functionality for printing Scala values on the terminal. There are also functions for reading specific values. Console also defines constants for marking up text on ANSI terminals.
object Iterable

object Iterator
The Iterator object provides various functions for creating specialized iterators.
object List
This object provides methods for creating specialized lists, and for transforming special kinds of lists (e.g. lists of lists).
object MatchError
This class implements errors which are thrown whenever an object doesn't match any pattern of a pattern matching expression.
case object Nil
The empty list.
case object None
This case object represents non-existent values.
object Predef
The Predef object provides definitions that are accessible in all Scala compilation units without explicit qualification.
object Responder
contains utility methods to build responders
object Seq

object Stream
The object Stream provides helper functions to manipulate streams.