title: Java Factory patterns
body: <p>Here is a factory "inner class?" from the Java Jung graph package:</p>
  
  <pre><code>   Factory&lt;Graph&lt;String, Integer&gt;&gt; graphFactory = new Factory&lt;Graph&lt;String, Integer&gt;&gt;()
     {
         public Graph&lt;String, Integer&gt; create()
         {
             return new SparseMultigraph&lt;String, Integer&gt;();
         }
     };
  </code></pre>
  
  <p>What I want to know is what programming language concept is the above? Especially what is this concept in Java? Is the above an inner class? It is clearly not a method. It seems odd to me because it constructs a Factory object and then has braces with a semicolon at the end with a method to create a graph.</p>