All I desire is to use some concurrent Set (that appears not to exist at all). Java uses java.util.concurrent.ConcurrentHashMap<K, Void>
to achieve that behavior. I'd like to do sth similar in Scala so I created instance of Scala HashMap (or Java ConcurrentHashMap) and tried to add some tuples:
val myMap = new HashMap[String, Unit]()
myMap + (("myStringKey", Unit))
This of course crashed the process of compilation as Unit is abstract and final.
How to make this work? Should I use Any
/AnyRef
instead? I must ensure nobody inserts any value.
Thanks for help