dotty.tools.dotc.util.ReadOnlySet.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scala3-compiler_3 Show documentation
Show all versions of scala3-compiler_3 Show documentation
scala3-compiler-bootstrapped
package dotty.tools.dotc.util
/** A class for the readonly part of mutable sets.
*/
abstract class ReadOnlySet[T]:
/** The entry in the set such that `isEqual(x, entry)`, or else `null`. */
def lookup(x: T): T | Null
def size: Int
def iterator: Iterator[T]
def contains(x: T): Boolean = lookup(x) != null
def foreach[U](f: T => U): Unit = iterator.foreach(f)
def toList: List[T] = iterator.toList
def isEmpty = size == 0
object ReadOnlySet:
def empty[T]: ReadOnlySet[T] = HashSet[T](4)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy