trait BasicSymbolTable[Key, Value] extends AnyRef
This trait represents a symbol table of generic key/value pairs.
It supports the usual put, get, contains, delete, size, and is-empty methods. It also provides a keys method for iterating over all of the keys.
A symbol table implements the associative array abstraction: when associating a value with a key that is already in the symbol table, the convention is to replace the old value with the new value.
Adapted from the book Algorithms 4 by R. Sedgewick and K. Wayne.
- See also
Section 3.1 of Algorithms, 4th Edition
Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne, Addison-Wesley Professional, 2011, ISBN 0-321-57351-X. http://algs4.cs.princeton.edu
- Alphabetic
- By Inheritance
- BasicSymbolTable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
apply(key: Key): Value
- returns
value paired with key
- Exceptions thrown
NoSuchElementExceptionif key is not in table
-
abstract
def
delete(key: Key): Unit
Removes key/value pair from table.
Removes key/value pair from table.
- Exceptions thrown
NoSuchElementExceptionif key is not in table
-
abstract
def
keys(): Iterable[Key]
- returns
all keys in the table
- abstract def size: Int
-
abstract
def
update(key: Key, value: Value): Unit
Inserts key/value pair into table.
Inserts key/value pair into table. Replaces value if key is already there.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- def contains(key: Key): Boolean
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def get(key: Key): Option[Value]
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- def getOrElse(key: Key, default: ⇒ Value): Value
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- def isEmpty: Boolean
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- BasicSymbolTable → AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )