title: Instantiate Array of Arrays in one line
body: <p>I am making a Java class where hierarchical data is stored. It is very similar to XML, and I would keep the entire structure in XML to be parsed later by Java, but we want to avoid the I/O overhead.</p>
  
  <p>Instead, I want to keep the data hard-coded in Java objects in global variables. The XML code would look like this:</p>
  
  <pre><code>&lt;Group name="Order"&gt;
     &lt;Milestone name="Tested" value="testedDate"/&gt;
     &lt;Milestone name="Created"&gt;
        &lt;Milestone name="Delivered" value="deliveredDate"/&gt;
        &lt;Milestone name="Pressed" value="someString"/&gt;
        &lt;Milestone name="Assembled" value="whatever"/&gt;
     &lt;/Milestone&gt;
     &lt;Milestone name="Ordered" value="something"/&gt;
  &lt;/Group&gt;
  </code></pre>
  
  <p>So I created classes with setters and getters and polymorphic constructors. The Group class has one constructor, takes the name attribute as a String input and an array of Milestone objects as another input:</p>
  
  <pre><code>public Group(String name, Milestone[] milestones) { ...... }
  </code></pre>
  
  <p>Note that the Milestone element however can have subelements of the same type. So I created a Milestone class with two constructors. The first constructor handles the first Milestone element. It takes just the name and value attributes as String inputs. The second constructor takes the name attribute as a String input, and also an array of Milestone objects as a second input.</p>
  
  <pre><code>public Milestone(String name, String value) { .....}
  public Milestone(String name, Milestone[] subMilestones) { ...... }
  </code></pre>
  
  <p>But now what I want to do is instantiate all of this in one line of code, like this:</p>
  
  <pre><code>Group[] groups = {
     new Group("Order",{
        new Milestone("Tested","testedDate"),
        new Milestone("Created",{
           new Milestone("Delivered","deliveredDate"),
           new Milestone("Pressed","someString"),
           new Milestone("Assembled","whatever")})
        new Milestone("Ordered","something")
     }
     new Group("Invoice",...
     ...
     ...
  };
  </code></pre>
  
  <p>It doesn't appear to like that. In short, it doesn't like me opening up brackets to start a new array of "new" Milestone objects within the declaration of Group array. Is there a way to do this all within one line of code (as in, in one declaration with one semicolon at the end)?</p>