org.clulab.wm.eidoscommon.utils.IdentityHashSet.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eidos-eidoscommon_2.12 Show documentation
Show all versions of eidos-eidoscommon_2.12 Show documentation
Code to be shared by other Eidos subprojects and clients
The newest version!
package org.clulab.wm.eidoscommon.utils
import scala.collection.JavaConverters._
import scala.collection.mutable
object IdentityHashSet {
type IdentityHashSet[T <: AnyRef] = mutable.Set[T]
def apply[T <: AnyRef](): IdentityHashSet[T] = {
val jMap = new java.util.IdentityHashMap[T, java.lang.Boolean]
val jSet = java.util.Collections.newSetFromMap[T](jMap)
val sSet = jSet.asScala
sSet
}
def apply[T <: AnyRef](values: Seq[T]): IdentityHashSet[T] = apply[T]() ++ values
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy