scala - Is there any way to abstrat enums ValueSet? -
I am using Scala 2.11, I have the following enums:
objects Value "value" ("work") value = "value" ("female") value = "value" ("female") object object ("female") object emailType calculation Expand {val personal = value ("personal") other ")} // object with this I .toString) Or
EmailType.values.toList.map (_to toString) I would like to have the same v Like to open the file
def enumToString (value: type here & gt;): list [string] = values. [_ ToString] I like the type of enums
val v1: gender.valueset = gender.values val v2: EmailType.ValueSet = EmailType.values I do not see how this kind of essence has been shown above to create common types of normal tasks. Is there any abstraction for this?
If you do values then this will work: def enumToString (value: traversal [count # value]): list [string] = values .to_list.map (_toString) scala & gt; = list (male, female, personal, work, other)
Comments
Post a Comment