title: How to create a custom list of objects in Java?
body: <p>Arraylists use the following syntax: <code>ArrayList&lt;Object&gt; = new ArrayList&lt;Object&gt;;</code>
  I need to add a constructor to my GameList class that allows you to specify what type of list to create. I don't understand how to make my class capable of being defined like this: </p>
  
  <pre><code>GameList&lt;objectType&gt; = new GameList();
  </code></pre>
  
  <p>All of my objects in the game will descend from the gameobject class.</p>
  
  <pre><code>public class GameObject
  {
      String name;
      public GameObject
      {
          name = "Stat";
      }
      public String getName()
      {
          return name;
      }
      public void setName(String newName)
      {
          name = newName;
      }
  }
  
  public class GameList
  {
      GameObject[] theList;
      public GameList(int size)
      {
          theList = new GameObject[size];
      }
      public GameObject parseList(String objectName)
      {
          for(int i = 0; i &lt; theList.length; i++)
              if(theList[i].getName() == objectName)
                  return theList[i];
          return null;
      }
  }
  </code></pre>