title: Predecessor and successor of an Enumeration value in Scala
body: <p>Is there a less convoluted way of finding the predecessor and successor of an enumerated value?</p>
  
  <pre><code>object E extends Enumeration {
     val W, X, Y, Z = Value
  }
  
  def succ(a: E.Value) : E.Value = {
     val arr = E.values.toArray
     return arr(a.id + 1)
  }
  
  
  scala&gt; succ(E.W)
  res17: E.Value = X
  
  scala&gt; succ(E.Y)
  res18: E.Value = Z
  </code></pre>