Answer by VonC for Creating a Java Enum in Scala
As explained in this thread, Dotty will have enum for Scala 3.0 (fall-2020)Scala redesigned Enums as well.They can be parameterized and can contain custom members.// Scala 2 way:object Day extends...
View ArticleAnswer by James_pic for Creating a Java Enum in Scala
Whilst it's probably not a good idea (see other posts for actual good ideas), it is possible to extend java.lang.Enum in Scala. Your code would have worked, if you'd put both the class and its...
View ArticleAnswer by Glen Best for Creating a Java Enum in Scala
Java EnumsFor an enum class Counter would be a better name than Counters - each enum value represents a singular counter.When javac compiles an enum class, it:compiles to a normal java class (E.g....
View ArticleAnswer by Daniel C. Sobral for Creating a Java Enum in Scala
If you need a java enumeration, then you need to write it in Java. There are things you can do in Scala to replace the use cases of Enum, but there's nothing in Scala that replicates the Java mechanics...
View ArticleCreating a Java Enum in Scala
My workplace has been experimenting in moving from Java to Scala for some tasks, and it works well for what we're doing. However, some preexisting logging methods expect a java.lang.Enum. The logging...
View Article
More Pages to Explore .....