title: What's the best way to extract a single value from a Set in groovy?
body: <p>If I have a Set that I know contains a single element, what's the best way to extract it?  The best I can come up with is this, but it doesn't feel very groovy:</p>
  
  <pre><code>set = [1] as Set
  e = set.toList()[0]
  assert e == 1
  </code></pre>
  
  <p>If I'm dealing with a list, I've got lots of nice ways to get the element, none of which seem to work with Sets:</p>
  
  <pre><code>def list = [1]
  e = list[0]
  (e) = list
  e = list.head()
  </code></pre>