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

dotty.tools.dotc.util.MutableSet.scala Maven / Gradle / Ivy

There is a newer version: 3.6.4-RC1-bin-20241220-0bfa1af-NIGHTLY
Show newest version
package dotty.tools.dotc.util

/** A common class for lightweight mutable sets.
 */
abstract class MutableSet[T] extends ReadOnlySet[T]:

  /** Add element `x` to the set */
  def +=(x: T): Unit

  /** Like `+=` but return existing element equal to `x` of it exists,
   *  `x` itself otherwise.
   */
  def put(x: T): T

  /** Remove element `x` from the set */
  def -=(x: T): Unit

  /** Remove all elements from this set.
   *  @param resetToInitial If true, set back to initial configuration, which includes
   *                        reallocating tables.
   */
  def clear(resetToInitial: Boolean = true): Unit

  def ++= (xs: IterableOnce[T]): Unit =
    xs.iterator.foreach(this += _)

  def --= (xs: IterableOnce[T]): Unit =
    xs.iterator.foreach(this -= _)





© 2015 - 2025 Weber Informatics LLC | Privacy Policy