Skip to content

Instantly share code, notes, and snippets.

@joakim-ribier
Last active February 22, 2016 06:02
Show Gist options
  • Select an option

  • Save joakim-ribier/1ab794f965f02058bb26 to your computer and use it in GitHub Desktop.

Select an option

Save joakim-ribier/1ab794f965f02058bb26 to your computer and use it in GitHub Desktop.
[scala] Generic method transforms string to Enum
private def transform[T <: Enumeration](values: Option[String], enum: T): Option[Seq[T#Value]] = {
values.map(_.split(",").toSeq.map(f => enum.withName(f)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment