Skip to content

Instantly share code, notes, and snippets.

@b-studios
Created January 12, 2014 17:32
Show Gist options
  • Save b-studios/8387801 to your computer and use it in GitHub Desktop.
Save b-studios/8387801 to your computer and use it in GitHub Desktop.
`IdentityHashMap` as adopted from `scala.collection.mutable.WeakHashMap`
package de.bstudios.collection.mutable
import scala.collection.mutable._
import scala.collection.generic._
import scala.collection.convert.Wrappers._
class IdentityHashMap[A, B] extends JMapWrapper[A, B](new java.util.IdentityHashMap)
with JMapWrapperLike[A, B, IdentityHashMap[A, B]] {
override def empty = new IdentityHashMap[A, B]
}
object IdentityHashMap extends MutableMapFactory[IdentityHashMap] {
implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), IdentityHashMap[A, B]] =
new MapCanBuildFrom[A, B]
def empty[A, B]: IdentityHashMap[A, B] = new IdentityHashMap[A, B]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment