diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-04-10 15:20:46 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-04-10 15:20:46 +0000 |
commit | e2decb09ed9cbfad6e1c61b68e24423620d01ff3 (patch) | |
tree | a7970f709b9ebaf3f63d6865bc76c45f1c653cff /src/library/scala/collection/mutable/FlatHashTable.scala | |
parent | 519214dcc68c941afb45ef6e749ec0afdb10af65 (diff) | |
download | scala-e2decb09ed9cbfad6e1c61b68e24423620d01ff3.tar.gz scala-e2decb09ed9cbfad6e1c61b68e24423620d01ff3.tar.bz2 scala-e2decb09ed9cbfad6e1c61b68e24423620d01ff3.zip |
More docs. No review.
Diffstat (limited to 'src/library/scala/collection/mutable/FlatHashTable.scala')
-rw-r--r-- | src/library/scala/collection/mutable/FlatHashTable.scala | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/library/scala/collection/mutable/FlatHashTable.scala b/src/library/scala/collection/mutable/FlatHashTable.scala index ea4033d405..05eafbc811 100644 --- a/src/library/scala/collection/mutable/FlatHashTable.scala +++ b/src/library/scala/collection/mutable/FlatHashTable.scala @@ -11,8 +11,15 @@ package scala.collection package mutable -/** An implementation class backing a HashSet. - * @since 2.3 + +/** An implementation class backing a `HashSet`. + * + * This trait is used internally. It can be mixed in with various collections relying on + * hash table as an implementation. + * + * @since 2.3 + * + * @tparam A the type of the elements contained in the flat hash table. */ trait FlatHashTable[A] { @@ -85,6 +92,7 @@ trait FlatHashTable[A] { iterator.foreach(out.writeObject) } + /** Finds an entry in the hash table if such an element exists. */ def findEntry(elem: A): Option[A] = { var h = index(elemHashCode(elem)) var entry = table(h) @@ -95,6 +103,7 @@ trait FlatHashTable[A] { if (null == entry) None else Some(entry.asInstanceOf[A]) } + /** Checks whether an element is contained in the hash table. */ def containsEntry(elem: A): Boolean = { var h = index(elemHashCode(elem)) var entry = table(h) @@ -105,8 +114,8 @@ trait FlatHashTable[A] { null != entry } - /** Add entry if not yet in table - * Return whether a new entry was added + /** Add entry if not yet in table. + * @return Returns `true` if a new entry was added, `false` otherwise. */ def addEntry(elem: A) : Boolean = { var h = index(elemHashCode(elem)) @@ -122,6 +131,7 @@ trait FlatHashTable[A] { true } + /** Removes an entry from the hash table, returning an option value with the element, or `None` if it didn't exist. */ def removeEntry(elem: A) : Option[A] = { if (tableDebug) checkConsistent() def precedes(i: Int, j: Int) = { |