Skip to content

Commit

Permalink
Merge pull request #11 from alexarchambault/iterable-class-name
Browse files Browse the repository at this point in the history
Override Iterable.className
  • Loading branch information
alexarchambault authored Feb 22, 2022
2 parents 2143b1b + b7e2823 commit 37f65f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dependency/src/main/scala-2.13/dependency/CovariantSet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class CovariantSet[+A] private (private val elements: List[A])
with IterableOps[A, CovariantSet, CovariantSet[A]]
with IterableFactoryDefaults[A, CovariantSet] {

protected[this] override def className: String = "CovariantSet"

def +=[B >: A](elem: B): CovariantSet[B] =
if (elements.contains(elem))
this
Expand Down
4 changes: 3 additions & 1 deletion dependency/src/main/scala-3/dependency/CovariantSet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class CovariantSet[+A] private (private val elements: List[A])
with IterableOps[A, CovariantSet, CovariantSet[A]]
with IterableFactoryDefaults[A, CovariantSet] {

protected[this] override def className: String = "CovariantSet"

def +=[B >: A](elem: B): CovariantSet[B] =
if (elements.contains(elem))
this
Expand All @@ -34,7 +36,7 @@ class CovariantSet[+A] private (private val elements: List[A])

object CovariantSet extends IterableFactory[CovariantSet] {
def from[A](source: IterableOnce[A]): CovariantSet[A] =
new CovariantSet[A](source.toList.distinct)
new CovariantSet[A](source.iterator.toList.distinct)
def empty[A]: CovariantSet[A] =
new CovariantSet[A](Nil)
def newBuilder[A]: Builder[A, CovariantSet[A]] =
Expand Down

0 comments on commit 37f65f3

Please sign in to comment.