title: Why does EnumSet have many overloaded "of" methods?
body: <p>While going through the <code>EnumSet&lt;E&gt;</code> <code>of</code> method, I have seen multiple overloaded implementations of <code>of</code> method:</p>
  
  <pre><code>public static &lt;E extends Enum&lt;E&gt;&gt; EnumSet&lt;E&gt; of(E e)
  
  public static &lt;E extends Enum&lt;E&gt;&gt; EnumSet&lt;E&gt; of(E e1, E e2)
  
  .
  .
  
  public static &lt;E extends Enum&lt;E&gt;&gt; EnumSet&lt;E&gt; of(E e1, E e2, E e3, E e4, E e5)
  </code></pre>
  
  <p>and then another overloaded method with <code>varargs</code></p>
  
  <pre><code>public static &lt;E extends Enum&lt;E&gt;&gt; EnumSet&lt;E&gt; of(E first, E... rest) {
      EnumSet&lt;E&gt; result = noneOf(first.getDeclaringClass());
      result.add(first);
      for (E e : rest)
          result.add(e);
      return result;
  }
  </code></pre>
  
  <p>When this varargs could have handled the other implementations, why this method is overloaded this way? Is there any specific reason for this? </p>
  
  <p>I had gone through the Javadoc of the same, but I could not find any convincing explanation.</p>