title: Generics method signature
body: <p>I have 2 different maps of different types, both of which are subclasses of <code>BaseClass</code>.</p>
  
  <p>I has hoping to be able to use the same logic for 'saving' an item to the map for both cases, using Generics.</p>
  
  <p>assume <code>getId</code> is a method of <code>BaseClass</code>.</p>
  
  <p>I need to force</p>
  
  <ol>
  <li>the <code>item</code> to be a subclass of <code>BaseClass</code></li>
  <li>the <code>map</code> value to be the same type as the <code>item</code></li>
  </ol>
  
  <p>How can I do this? here is a failed attempt which kind of describes what I need to do:</p>
  
  <pre><code>private &lt;T&gt;&lt;?extends BaseClass&gt; void save(T item, Map&lt;Long, T&gt; map)
  {
      if (item.getId() == null)
      {
          long max = -1;
          for (Long key : map.keySet())
              max = Math.max(max, key);
          item.setId(max + 1);
      }
      map.put(item.getId(), item);
  }
  </code></pre>