Scala 2.8.0.Beta1-RC1 API

This document is the API specification for Scala Library

Class Summary
class AddingBuilder [A, Coll <: Addable[A, Coll] with Iterable[A] with IterableLike[A, Coll]](empty : Coll) extends Builder[A, Coll]
The canonical builder for collections that are addable, i.e. that support an efficient + method which adds an element to the collection. Collections are built from their empty element using this + method.
class ArrayBuffer [A](protected val override initialSize : Int) extends Buffer[A] with GenericTraversableTemplate[A, ArrayBuffer] with BufferLike[A, ArrayBuffer[A]] with IndexedSeqLike[A, ArrayBuffer[A]] with Builder[A, ArrayBuffer[A]] with ResizableArray[A]
An implementation of the Buffer class using an array to represent the assembled sequence internally. Append, update and random access take constant time (amortized time). Prepends and removes are linear in the buffer size.
abstract class ArrayBuilder [T] extends Builder[T, Array[T]]
A builder class for arrays
trait ArrayLike [A, +Repr] extends IndexedSeqLike[A, Repr]
A subtrait of collection.IndexedSeq which represents sequences that can be mutated.
abstract class ArrayOps [T] extends ArrayLike[T, Array[T]]
class ArrayStack [T](private table : Array[AnyRef], private index : Int) extends Seq[T] with Cloneable[ArrayStack[T]]
Simple stack class backed by an array. Should be significantly faster than the standard mutable stack.
class BitSet (protected val elems : Array[Long]) extends Set[Int] with BitSet with BitSetLike[BitSet] with SetLike[Int, BitSet]
A class for mutable bitsets.
trait Buffer [A] extends Seq[A] with GenericTraversableTemplate[A, Buffer] with BufferLike[A, Buffer[A]]
Buffers are used to create sequences of elements incrementally by appending, prepending, or inserting new elements. It is also possible to access and modify elements in a random access fashion via the index of the element in the current sequence.
trait BufferLike [A, +This <: BufferLike[A, This] with Buffer[A]] extends Growable[A] with Shrinkable[A] with Scriptable[A] with Addable[A, This] with Subtractable[A, This] with Cloneable[This] with SeqLike[A, This]
Buffers are used to create sequences of elements incrementally by appending, prepending, or inserting new elements. It is also possible to access and modify elements in a random access fashion via the index of the element in the current sequence.
trait BufferProxy [A] extends Buffer[A] with Proxy
This is a simple proxy class for scala.collection.mutable.Buffer. It is most useful for assembling customized set abstractions dynamically using object composition and forwarding.
trait Builder [-Elem, +To] extends Growable[Elem]
The base trait of all builders. A builder lets one construct a collection incrementally, by adding elements to the builder with += and then converting to the required collection type with `result`.
trait Cloneable [+A <: AnyRef] extends AnyRef
A trait for cloneable collections.
trait CloneableCollection extends AnyRef
The J2ME version of the library defined this trait with a clone method to substitute for the lack of Object.clone there.
final class DefaultEntry [A, B](val key : A, val value : B) extends HashEntry[A, DefaultEntry[A, B]]
trait DefaultMapModel [A, B] extends Map[A, B]
This class is used internally. It implements the mutable Map class in terms of three functions: findEntry, addEntry, and entries.
class DoubleLinkedList [A](_elem : A, _next : DoubleLinkedList[A]) extends LinearSeq[A] with GenericTraversableTemplate[A, DoubleLinkedList] with DoubleLinkedListLike[A, DoubleLinkedList[A]]
This class implements single linked lists where both the head (elem) and the tail (next) are mutable.
trait DoubleLinkedListLike [A, This <: Seq[A] with DoubleLinkedListLike[A, This]] extends LinkedListLike[A, This]
This extensible class may be used as a basis for implementing double linked lists. Type variable A refers to the element type of the list, type variable This is used to model self types of linked lists.
trait FlatHashTable [A] extends AnyRef
class GenericArray [A](val override length : Int) extends IndexedSeq[A] with GenericTraversableTemplate[A, GenericArray] with IndexedSeqLike[A, GenericArray[A]]
This class is used internally to implement data structures that are based on resizable arrays.
trait HashEntry [A, E] extends AnyRef
class HashMap [A, B] extends Map[A, B] with MapLike[A, B, HashMap[A, B]] with HashTable[A]
class HashSet [A] extends Set[A] with GenericSetTemplate[A, HashSet] with SetLike[A, HashSet[A]] with FlatHashTable[A]
This class implements mutable sets using a hashtable.
trait HashTable [A] extends AnyRef
This class can be used to construct data structures that are based on hashtables. Class HashTable[A] implements a hashtable that maps keys of type A to values of the fully abstract member type Entry. Classes that make use of HashTable have to provide an implementation for Entry There are mainly two parameters that affect the performance of a hashtable: the initial size and the load factor. The size refers to the number of buckets in the hashtable, and the load factor is a measure of how full the hashtable is allowed to get before its size is automatically doubled. Both parameters may be changed by overriding the corresponding values in class HashTable.
class History [A, B] extends Subscriber[A, B] with Iterable[(B, A)]
History[A, B] objects may subscribe to events of type A published by an object of type B. The history subscriber object records all published events up to maximum number of maxHistory events.
class ImmutableMapAdaptor [A, B](protected val imap : Map[A, B]) extends Map[A, B]
This class can be used as an adaptor to create mutable maps from immutable map implementations. Only method empty has to be redefined if the immutable map on which this mutable map is originally based is not empty. empty is supposed to return the representation of an empty map.
class ImmutableSetAdaptor [A](protected val set : Set[A]) extends Set[A]
This class can be used as an adaptor to create mutable sets from immutable set implementations. Only method empty has to be redefined if the immutable set on which this mutable set is originally based is not empty. empty is supposed to return the representation of an empty set.
trait IndexedSeq [A] extends Seq[A] with IndexedSeq[A] with GenericTraversableTemplate[A, IndexedSeq] with IndexedSeqLike[A, IndexedSeq[A]]
A subtrait of collection.IndexedSeq which represents sequences that can be mutated.
trait IndexedSeqLike [A, +Repr] extends IndexedSeqLike[A, Repr]
A subtrait of scala.collection.IndexedSeq which represents sequences that can be mutated.
trait IndexedSeqView [A, +Coll] extends IndexedSeqView[A, Coll] with AnyRef
A non-strict view of a mutable IndexedSeq. This is a leaf class which mixes methods returning a plain IndexedSeq view and methods returning a mutable IndexedSeq view. There is no associated `Like' class.
trait Iterable [A] extends Traversable[A] with Iterable[A] with GenericTraversableTemplate[A, Iterable] with IterableLike[A, Iterable[A]]
abstract class LazyBuilder [Elem, +To] extends Builder[Elem, To]
A builder that constructs its result lazily. Iterators or iterables to be added to this builder with `++=` are not evaluated until `result` is called.
trait LinearSeq [A] extends Seq[A] with LinearSeq[A] with GenericTraversableTemplate[A, LinearSeq] with LinearSeqLike[A, LinearSeq[A]]
A subtrait of collection.Seq which represents sequences that cannot be mutated.
final class LinkedEntry [A, B](val key : A, val value : B) extends HashEntry[A, LinkedEntry[A, B]]
class LinkedHashMap [A, B] extends Map[A, B] with MapLike[A, B, LinkedHashMap[A, B]] with HashTable[A]
class LinkedHashSet [A] extends Set[A] with GenericSetTemplate[A, LinkedHashSet] with SetLike[A, LinkedHashSet[A]] with FlatHashTable[A]
Todo: this has O(n) cost for element removal. Should be rewritten to be more efficient.
class LinkedList [A] extends LinearSeq[A] with GenericTraversableTemplate[A, LinkedList] with LinkedListLike[A, LinkedList[A]]
This class implements single linked lists where both the head (elem) and the tail (next) are mutable.
trait LinkedListLike [A, This <: Seq[A] with LinkedListLike[A, This]] extends SeqLike[A, This]
This extensible class may be used as a basis for implementing linked list. Type variable A refers to the element type of the list, type variable This is used to model self types of linked lists.
final class ListBuffer [A] extends Buffer[A] with GenericTraversableTemplate[A, ListBuffer] with BufferLike[A, ListBuffer[A]] with Builder[A, List[A]] with SeqForwarder[A]
A Buffer implementation back up by a list. It provides constant time prepend and append. Most other operations are linear.
class ListMap [A, B] extends Map[A, B] with MapLike[A, B, ListMap[A, B]]
trait Map [A, B] extends Iterable[(A, B)] with Map[A, B] with MapLike[A, B, Map[A, B]]
class MapBuilder [A, B, Coll <: Map[A, B] with MapLike[A, B, Coll]](empty : Coll) extends Builder[(A, B), Coll]
The canonical builder for immutable maps, working with the map's `+` method to add new elements. Collections are built from their `empty` element using this + method.
trait MapLike [A, B, +This <: MapLike[A, B, This] with Map[A, B]] extends MapLikeBase[A, B, This] with Builder[(A, B), This] with Shrinkable[A]
trait MapLikeBase [A, B, +This <: MapLikeBase[A, B, This] with Map[A, B]] extends MapLike[A, B, This] with Cloneable[This]
The reason for this class is so that we can have both a generic immutable `+` with signature def + [B1 >: B](kv: (A, B1)): Map[A, B1] and a (deprecated) mutable `+` of signature def + (kv: (A, B)): this.type = this += kv The former is required to fulfill the Map contract. The latter is required for backwards compatibility. We can't have both methods in the same class, as that would give a double definition. They are OK in different classes though, and narrowly escape a `same erasure' problem. Once the deprecated + goes away we can do without class MapLikeBase.
trait MapProxy [A, B] extends Map[A, B] with MapProxyLike[A, B, Map[A, B]]
trait MultiMap [A, B] extends Map[A, Set[B]]
This class is typically used as a mixin. It turns maps which map A to Set[B] objects into multi maps which map A to B objects.
class MutableList [A] extends LinearSeq[A] with LinearSeqLike[A, MutableList[A]] with Builder[A, MutableList[A]]
trait ObservableBuffer [A, This <: ObservableBuffer[A, This]] extends Buffer[A] with Publisher[Message[A] with Undoable, This]
This class is typically used as a mixin. It adds a subscription mechanism to the Buffer class into which this abstract class is mixed in. Class ObservableBuffer publishes events of the type Message.
trait ObservableMap [A, B, This <: ObservableMap[A, B, This]] extends Map[A, B] with Publisher[Message[(A, B)] with Undoable, This]
This class is typically used as a mixin. It adds a subscription mechanism to the Map class into which this abstract class is mixed in. Class ObservableMap publishes events of the type Message.
trait ObservableSet [A, This <: ObservableSet[A, This]] extends Set[A] with Publisher[Message[A] with Undoable, This]
This class is typically used as a mixin. It adds a subscription mechanism to the Set class into which this abstract class is mixed in. Class ObservableSet publishes events of the type Message.
class OpenHashMap [Key, Value](initialSize : Int) extends Map[Key, Value]
A mutable hash map based on an open hashing scheme. The precise scheme is undefined, but it should make a reasonable effort to ensure that an insert with consecutive hash codes is not unneccessarily penalised. In particular, mappings of consecutive integer keys should work without significant performance loss.
class PriorityQueue [A](implicit ord : Ordering[A]) extends ResizableArray[A] with Addable[A, PriorityQueue[A]] with Growable[A] with Cloneable[PriorityQueue[A]]
This class implements priority queues using a heap. To prioritize elements of type T there must be an implicit Ordering[T] available at creation. Martin: This class is utterly broken. It uses a resizable array as a heap, yet pretends to be a sequence via this same resizable array. Needless to say, order of elements is different in the two. So this class needs to be redesigned so that it uses the array only in its implementation, but implements a sequence interface separately.
abstract class PriorityQueueProxy [A](implicit ord : Ordering[A]) extends PriorityQueue[A] with Proxy
This class implements priority queues using a heap. The elements of the queue have to be ordered in terms of the Ordered[T] class.
trait Publisher [A, This <: Publisher[A, This]] extends AnyRef
Publisher[A,This] objects publish events of type A to all registered subscribers. When subscribing, a subscriber may specify a filter which can be used to constrain the number of events sent to the subscriber. Subscribers may suspend their subscription, or reactivate a suspended subscription. Class Publisher is typically used as a mixin. The type variable This models self types.
class Queue [A] extends MutableList[A] with Cloneable[Queue[A]]
Queue objects implement data structures that allow to insert and retrieve elements in a first-in-first-out (FIFO) manner.
trait QueueProxy [A] extends Queue[A] with Proxy
Queue objects implement data structures that allow to insert and retrieve elements in a first-in-first-out (FIFO) manner.
trait ResizableArray [A] extends IndexedSeq[A] with GenericTraversableTemplate[A, ResizableArray] with IndexedSeqLike[A, ResizableArray[A]]
This class is used internally to implement data structures that are based on resizable arrays.
class RevertibleHistory [A <: Undoable, B] extends History[A, B] with Undoable
A revertible history is a History object which supports an undo operation. Type variable A refers to the type of the published events, B denotes the publisher type. Type B is typically a subtype of Publisher.
trait Seq [A] extends Iterable[A] with Seq[A] with GenericTraversableTemplate[A, Seq] with SeqLike[A, Seq[A]]
A subtrait of collection.Seq which represents sequences that can be mutated. The class adds an update method to collection.Seq.
trait Set [A] extends Iterable[A] with Set[A] with GenericSetTemplate[A, Set] with SetLike[A, Set[A]]
A generic trait for mutable sets. Concrete set implementations have to provide functionality for the abstract methods in Set: def contains(elem: A): Boolean def iterator: Iterator[A] def += (elem: A): this.type def -= (elem: A): this.type
class SetBuilder [A, Coll <: Addable[A, Coll] with Iterable[A] with IterableLike[A, Coll]](empty : Coll) extends Builder[A, Coll]
The canonical builder for collections that are addable, i.e. that support an efficient + method which adds an element to the collection. Collections are built from their empty element using this + method.
trait SetLike [A, +This <: SetLike[A, This] with Set[A]] extends SetLike[A, This] with Scriptable[A] with Builder[A, This] with Shrinkable[A] with Cloneable[Set[A]]
trait SetProxy [A] extends Set[A] with SetProxyLike[A, Set[A]]
This is a simple wrapper class for scala.collection.mutable.Set. It is most useful for assembling customized set abstractions dynamically using object composition and forwarding.
class Stack [A](val elems : List[A]) extends Seq[A] with Cloneable[Stack[A]]
A stack implements a data structure which allows to store and retrieve objects in a last-in-first-out (LIFO) fashion.
trait StackProxy [A] extends Stack[A] with Proxy
A stack implements a data structure which allows to store and retrieve objects in a last-in-first-out (LIFO) fashion.
final class StringBuilder (initCapacity : Int, private initValue : java.lang.String) extends Builder[Char, java.lang.String] with IndexedSeq[Char]
trait Subscriber [-A, -B] extends AnyRef
Subscriber[A, B] objects may subscribe to events of type A published by an object of type B. B is typically a subtype of Publisher.
trait SynchronizedBuffer [A] extends Buffer[A]
This class should be used as a mixin. It synchronizes the Buffer methods of the class into which it is mixed in.
trait SynchronizedMap [A, B] extends Map[A, B]
This class should be used as a mixin. It synchronizes the Map functions of the class into which it is mixed in.
class SynchronizedPriorityQueue [A](implicit ord : Ordering[A]) extends PriorityQueue[A]
This class implements synchronized priority queues using a heap. The elements of the queue have to be ordered in terms of the Ordered[T] class.
class SynchronizedQueue [A] extends Queue[A]
This is a synchronized version of the Queue[T] class. It implements a data structure that allows one to insert and retrieve elements in a first-in-first-out (FIFO) manner.
trait SynchronizedSet [A] extends Set[A]
This class should be used as a mixin. It synchronizes the Set functions of the class into which it is mixed in.
class SynchronizedStack [A] extends Stack[A]
This is a synchronized version of the Stack[T] class. It implements a data structure which allows to store and retrieve objects in a last-in-first-out (LIFO) fashion.
trait Traversable [A] extends Traversable[A] with GenericTraversableTemplate[A, Traversable] with TraversableLike[A, Traversable[A]] with Mutable
A subtrait of collection.Traversable which represents traversables that can be mutated.
trait Undoable extends AnyRef
Classes that mix in the Undoable class provide an operation undo which can be used to undo the last operation.
class WeakHashMap [A, B] extends JMapWrapper[A, B]
abstract class WrappedArray [T] extends IndexedSeq[T] with ArrayLike[T, WrappedArray[T]]
class WrappedArrayBuilder [A](manifest : ClassManifest[A]) extends Builder[A, WrappedArray[A]]
A builder class for arrays
Object Summary
object ArrayBuffer extends SeqFactory[ArrayBuffer]
Factory object for ArrayBuffer class.
object ArrayBuilder extends AnyRef
object ArrayOps extends AnyRef
object BitSet extends BitSetFactory[BitSet]
A factory object for mutable bitsets
object Buffer extends SeqFactory[Buffer]
Factory object for Buffer trait.
object DoubleLinkedList extends SeqFactory[DoubleLinkedList]
object GenericArray extends SeqFactory[GenericArray]
object HashMap extends MutableMapFactory[HashMap]
This class implements mutable maps using a hashtable.
object HashSet extends SetFactory[HashSet]
Factory object for `HashSet` class
object IndexedSeq extends SeqFactory[IndexedSeq]
object Iterable extends TraversableFactory[Iterable]
object LinearSeq extends SeqFactory[LinearSeq]
object LinkedHashMap extends MutableMapFactory[LinkedHashMap]
This class implements mutable maps using a hashtable.
object LinkedHashSet extends SetFactory[LinkedHashSet]
Factory object for `LinkedHashSet` class
object LinkedList extends SeqFactory[LinkedList]
object ListBuffer extends SeqFactory[ListBuffer]
Factory object for ListBuffer class.
object ListMap extends MutableMapFactory[ListMap]
This class implements mutable maps using a list.
object Map extends MutableMapFactory[Map]
object OpenHashMap extends AnyRef
object ResizableArray extends SeqFactory[ResizableArray]
object Seq extends SeqFactory[Seq]
A factory object for the trait Seq.
object Set extends SetFactory[Set]
The canonical factory methods for mutable sets. Currently this returns a HashSet.
object StringBuilder extends AnyRef
object Traversable extends TraversableFactory[Traversable]
A factory object for the trait Traversable.
object WrappedArray extends AnyRef