title: Is there syntactic sugar when declaring generic types?
body: <p>Suppose I have this class</p>
  
  <pre><code>class Generic&lt;T extends List&lt;? extends Integer&gt;, E extends List&lt;? extends Integer&gt;&gt;
  </code></pre>
  
  <p>or any long generic type inside the diamond brackets. When working with this class, in order to keep type safety, I need to keep mentioning the generic type. So, for example, if I want to iterate over a <code>Set</code> of the above class or manipulate it, I need to do the following:</p>
  
  <pre><code>class SomeClass {
  
      &lt;T extends List&lt;? extends Integer&gt;, E extends List&lt;? extends Integer&gt;&gt; void add(Set&lt;Generic&lt;T, E&gt;&gt; mySet, Generic&lt;T, E&gt; toAdd) {
  
          mySet.add(toAdd);
      }
  
      &lt;T extends List&lt;? extends Integer&gt;, E extends List&lt;? extends Integer&gt;&gt; void iterate(Set&lt;Generic&lt;T, E&gt;&gt; mySet) {
  
          for (Generic&lt;T, E&gt; myGeneric : mySet)
          {
                  // do something with myGeneric
          }
      }
  }
  </code></pre>
  
  <p>However, this becomes very cumbersome very quickly. I searched and could not find some sort of way to deal with this properly. I know that one can write <code>Generic&lt;?, ?&gt;</code> but this hinders type safety checks as much as I know.</p>
  
  <p>Is there a way to deal with this properly? Some way to name <code>T extends List&lt;? extends Integer&gt;, E extends List&lt;? extends Integer</code> and use that name just as a syntax shortcut maybe?</p>
  
  <p><strong>Quick note:</strong> I am not talking about the <em>initialization</em> syntactic sugar introduced in Java 7 where the right hand side can have empty diamond brackets using type inference from the <em>declaration</em>.</p>