title: SortedSet or sorted Collection
body: <p>Assume an application producing a number of <code>HashMap&lt;String, MyClass&gt;</code> data structures, each containing dozens to hundreds of <code>Comparable</code> objects of type <code>MyClass</code>, which need to end up in a single and sorted <code>Collection</code>.</p>
  
  <p>Two possible implementations of this functionality return a SortedSet or a sorted List, as follows:</p>
  
  <pre><code>public static Set&lt;MyClass&gt; getSortedSet(HashMap&lt;String, MyClass&gt;... allMaps)
  {
      SortedSet&lt;MyClass&gt; set = new TreeSet&lt;MyClass&gt;();
  
      Collection&lt;MyClass&gt; c;
  
      for (HashMap&lt;String, MyClass&gt; map:allMaps)
      {
          c = map.values();
          set.addAll(c);
      }
  
      return set;
  }
  
  public static List&lt;MyClass&gt; getSortedList(HashMap&lt;String, MyClass&gt;... allMaps)
  {
      List&lt;MyClass&gt; list = new ArrayList&lt;MyClass&gt;();
  
      Collection&lt;MyClass&gt; c;
  
      for (HashMap&lt;String, MyClass&gt; map:allMaps)
      {
          c = map.values();
          list.addAll(c);
      }
  
      Collections.sort(list);
  
      return list;
  }
  </code></pre>
  
  <p>Would there be any clear performance advantage to any of the above 2 methods?</p>
  
  <p>Is there a faster way of implementing the same functionality?</p>