title: Creating Nested Lists
body: <p>How do I create nested lists in java? so I have a factory method below which will pass a list to the constructor of the ROOM class. But I need to associate each wall with a window, So when I iterate over the list in the constructor it knows that a certain window belongs to a certain wall?.</p>
  
  <pre><code>public static Room RoomU(){
      List&lt;Room&gt; RoomU = new ArrayList&lt;Room&gt;();
  
      // THESE TWO SHOULD BE PAIRED AND SO ON...
      RoomU.add(new Walls(Height, Width));
      RoomU.add(new Windows(Height,Width));
  
      RoomU.add(new Walls(Height, Width));
      RoomU.add(new Windows(Height,Width));
  
      RoomU.add(new Walls(Height, Width));
      RoomU.add(new Windows(Height,Width));
  
      RoomU.add(new Walls(Height, Width));
      RoomU.add(new Windows(Height,Width));
  
      RoomU.add(new Walls(Height, Width));
      RoomU.add(new Windows(Height,Width));
  
      return new Room(RoomU);
  }
  </code></pre>