Skip to content

Commit

Permalink
Add HashSet to stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Nov 1, 2023
1 parent dc31c5f commit 2cc5d36
Show file tree
Hide file tree
Showing 4 changed files with 460 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/pos-special/stdlib/collection/Iterator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ trait Iterator[+A] extends IterableOnce[A] with IterableOnceOps[A, Iterator, Ite
*/
def distinctBy[B](f: A -> B): Iterator[A]^{this} = new AbstractIterator[A] {

private[this] val traversedValues = mutable.HashSet.empty[B]
private[this] val traversedValues = mutable.HashSet.empty[B @uncheckedCaptures]
private[this] var nextElementDefined: Boolean = false
private[this] var nextElement: A = _

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait StrictOptimizedSeqOps [+A, +CC[_], +C]

override def distinctBy[B](f: A -> B): C = {
val builder = newSpecificBuilder
val seen = mutable.HashSet.empty[B]
val seen = mutable.HashSet.empty[B @uncheckedCaptures]
val it = this.iterator
while (it.hasNext) {
val next = it.next()
Expand Down
Loading

0 comments on commit 2cc5d36

Please sign in to comment.