title: How to lowercase every element of a collection efficiently?
body: <p>What's the most efficient way to lower case every element of a List or Set?</p>
  
  <p>My idea for a List:</p>
  
  <pre><code>final List&lt;String&gt; strings = new ArrayList&lt;String&gt;();
  strings.add("HELLO");
  strings.add("WORLD");
  
  for(int i=0,l=strings.size();i&lt;l;++i)
  {
    strings.add(strings.remove(0).toLowerCase());
  }
  </code></pre>
  
  <p>Is there a better, faster way? How would this example look like for a Set? As there is currently no method for applying an operation to each element of a Set (or List) can it be done without creating an additional temporary Set?</p>
  
  <p>Something like this would be nice:</p>
  
  <pre><code>Set&lt;String&gt; strings = new HashSet&lt;String&gt;();
  strings.apply(
    function (element)
    { this.replace(element, element.toLowerCase();) } 
  );
  </code></pre>
  
  <p>Thanks,</p>