All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scalax.collection.Compat.scala Maven / Gradle / Ivy

The newest version!
package scalax.collection

object Compat {
  type AbstractTraversable[+A] = scala.collection.AbstractTraversable[A]

  implicit final class TraversableEnrichments[A](val self: Traversable[A]) extends AnyVal {
    def toMSet: MSet[A] = self.to[MSet]
    def toSet: Set[A]   = self.to[Set]
  }

  implicit final class IterableEnrichments[A](val self: Iterable[A]) extends AnyVal {
    def toMSet: MSet[A] = self.to[MSet]
  }

  trait ExtBitSet {
    protected def writeReplace(): Any = throw new UnsupportedOperationException()
  }

  trait Growable[A] {
    def addOne(elem: A): this.type
    @inline def +=(elem: A): this.type = addOne(elem)
  }

  trait AddSubtract[A, +This] {
    def addOne(elem: A): this.type
    def subtractOne(elem: A): this.type
    @inline def +=(elem: A): this.type = addOne(elem)
    @inline def -=(elem: A): this.type = subtractOne(elem)
  }

  trait InclExcl[A, +This] {
    def incl(elem: A): This
    def excl(elem: A): This
    @inline def +(elem: A): This = incl(elem)
    @inline def -(elem: A): This = excl(elem)
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy