Skip to content

Instantly share code, notes, and snippets.

@tpolecat
Created February 11, 2013 17:05
Show Gist options
  • Save tpolecat/4755770 to your computer and use it in GitHub Desktop.
Save tpolecat/4755770 to your computer and use it in GitHub Desktop.
Map wrapper can easily return Some(null)
import scala.collection.convert.Wrappers.JMapWrapper
import java.util.Collections
object MapTest extends App {
val m = new JMapWrapper(Collections.synchronizedMap(new java.util.HashMap[String,String]))
new Thread {
override def run {
while (true) {
m += ("foo" -> "bar")
m -= "foo"
}
}
}.start()
new Thread {
override def run {
while (true) {
if (m.get("foo") == Some(null))
println("got null")
}
}
}.start()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment