title: How to remove Duplicate Values from a list in groovy
body: <p>I have a collection of ID list to be saved into the database </p>
  
  <pre><code>if(!session.ids)
  session.ids = []
  
  session.ids.add(params.id) 
  </code></pre>
  
  <p>and I found out that list has duplicates, like  </p>
  
  <pre><code>[1, 2, 4, 9, 7, 10, 8, 6, 6, 5]
  </code></pre>
  
  <p>Then I wanted to remove all duplicates by applying something like :</p>
  
  <pre><code>session.ids.removeAll{ //some clousure case }
  </code></pre>
  
  <p>I found only this:</p>
  
  <p><a href="http://groovy.codehaus.org/groovy-jdk/java/util/Collection.html" rel="noreferrer">http://groovy.codehaus.org/groovy-jdk/java/util/Collection.html</a></p>