diff options
author | James Iry <jamesiry@gmail.com> | 2013-01-04 19:41:00 -0800 |
---|---|---|
committer | James Iry <jamesiry@gmail.com> | 2013-01-04 19:41:00 -0800 |
commit | affa98fa54893830b88a9ebebd5d29740f10114c (patch) | |
tree | 094b796e1b4c5bac5a806848fd82a4ba00c15408 /src/library/scala/collection/mutable/FlatHashTable.scala | |
parent | b571637c2dbb20208543520f5802fe4de5115616 (diff) | |
download | scala-affa98fa54893830b88a9ebebd5d29740f10114c.tar.gz scala-affa98fa54893830b88a9ebebd5d29740f10114c.tar.bz2 scala-affa98fa54893830b88a9ebebd5d29740f10114c.zip |
SI-6916 makes FlatHashTable#remove a Boolean not Option[A]
Makes FlatHashTable#remove return a boolean instead of Option[A].
Updates HashSet accordingly. Adds a test to make sure remove
works as advertised.
Diffstat (limited to 'src/library/scala/collection/mutable/FlatHashTable.scala')
-rw-r--r-- | src/library/scala/collection/mutable/FlatHashTable.scala | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/library/scala/collection/mutable/FlatHashTable.scala b/src/library/scala/collection/mutable/FlatHashTable.scala index 9f7193495d..7f4a8d1cbd 100644 --- a/src/library/scala/collection/mutable/FlatHashTable.scala +++ b/src/library/scala/collection/mutable/FlatHashTable.scala @@ -160,8 +160,11 @@ trait FlatHashTable[A] extends FlatHashTable.HashUtils[A] { } - /** Removes an elem from the hash table, returning an option value with the element, or `None` if it didn't exist. */ - protected def removeElem(elem: A) : Option[A] = { + /** + * Removes an elem from the hash table returning true if the element was found (and thus removed) + * or false if it didn't exist. + */ + protected def removeElem(elem: A) : Boolean = { if (tableDebug) checkConsistent() def precedes(i: Int, j: Int) = { val d = table.length >> 1 @@ -189,12 +192,12 @@ trait FlatHashTable[A] extends FlatHashTable.HashUtils[A] { tableSize -= 1 nnSizeMapRemove(h0) if (tableDebug) checkConsistent() - return Some(entryToElem(curEntry)) + return true } h = (h + 1) % table.length curEntry = table(h) } - None + false } protected def iterator: Iterator[A] = new AbstractIterator[A] { |