title: Is there ever justification for the "pseudo-typedef antipattern"?
body: <p>I have a relatively complicated generic type (say <code>Map&lt;Long,Map&lt;Integer,String&gt;&gt;</code>) which I use internally in a class. (There is no external visibility; it's just an implementation detail.) I would like to hide this in a typedef, but Java has no such facility.</p>
  
  <p>Yesterday I rediscovered the following idiom and was disappointed to learn that it's <a href="http://www.ibm.com/developerworks/java/library/j-jtp02216/index.html" rel="nofollow noreferrer">considered an anti-pattern </a>.</p>
  
  <pre><code>
  class MyClass
  {
    /* "Pseudo typedef" */
    private static class FooBarMap extends HashMap&lt;Long,Map&lt;Integer,String&gt;&gt; { };
  
    FooBarMap[] maps;
  
    public FooBarMap getMapForType(int type)
    {
      // Actual code might be more complicated than this
      return maps[type];
    }
  
    public String getDescription(int type, long fooId, int barId)
    {
      FooBarMap map = getMapForType(type);
      return map.get(fooId).get(barId);
    }
  
    /* rest of code */
  
  }
  </code></pre>
  
  <p>Can there ever be any justification for this when the type is hidden and isn't forming part of a library API (which on my reading are Goetz's main objections to using it)?</p>