Open scabug opened 12 years ago
Imported From: https://issues.scala-lang.org/browse/SI-5547?orig=1 Reporter: Igor Petruk (igor-petruk)
@adriaanm said: We'll gladly take a pull request for this one, but unfortunately don't have the resources to implement this ourselves.
Igor Petruk (igor-petruk) said (edited on Mar 27, 2012 4:53:59 PM UTC): Good, I'll try to bring my implementation to a suitable form for Scala Collections
Todd Vierling (tvierling) said: Pull request submitted: https://github.com/scala/scala/pull/3716
Anna Szybalska (anula93) said: Is anyone working on this at the moment?
I have an idea of EnumMap written in Scala that should work on both Java Enum and Scala Enumerator, although for the latter it would be less efficient when small number of ids is distributed over very large range. I would be happy to implement this, but I would like to know if someone else is already almost finished with this.
Does anyone know what the status of this is and if it is still considered a worthwhile project?
Anna Szybalska (anula93) said: Since no one seems to have anything against, I started researching how to implement this. As for now I decided to create two classes: EnumMap (for Scala Enumeration) and JavaEnumMap (for Java enums). Both of them in mutable and immutable versions. Any thoughts?
It would be nice to have EnumMap in Scala that does query operations on enum key with high efficiency as java.util.EnumMap does. In my code I fill up the map with handlers, that handle specific message types. Since it is done dynamically I cannot use pattern matching. Plus this is a highly loaded piece of code, so I would like to use something as efficient as java.util.EnumMap. Unfortunately there is none in scala, so I have to use java one. It is java specific and not pretty, because you have to pass class type to constructor. Scala implementation could use Manifests
If it is a good idea, but core developers don't have time for this, post here and I can work on the patch or pull request.