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

org.clulab.wm.eidoscommon.utils.IdentityHashSet.scala Maven / Gradle / Ivy

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