You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose adding the following method to scala.Enumeration:
/* Returns a Value from this Enumeration whose name matches the argument <var>s</var>. * You must pass a String* set of names to the constructor, * or initialize each Enumeration with Value(String), * for valueOf to work. * @param s an enumeration name * @return <tt>Some(Value)</tt> if an enumeration's name matches <var>s</var>, * else <tt>None</tt>*/defvalueOf(s:String) = {
varv:Option[Value] =Nonefor( e <- elements ) if (s == e.toString()) v =Some(e)
v
}
Attached is a subclass of Enumeration which defines such a
method, and sample Enumerations which use the method to
show how it works for finding/matching values.
The text was updated successfully, but these errors were encountered:
I propose adding the following method to scala.Enumeration:
Attached is a subclass of Enumeration which defines such a
method, and sample Enumerations which use the method to
show how it works for finding/matching values.
The text was updated successfully, but these errors were encountered: