title: Dynamic assignement of arraylists
body: <p>In my project, in one of the classes (Adventure) I created an ArrayList and worked on it (add elements, delete others...)</p>
  <p>This ArrayList is then passed as a parameter when creating an instance of another class (Player) inside Adventure.</p>
  <p>Therefore I of course needed to created an ArrayList in Player and constructor, to catch the ArrayList sent from Adventure.</p>
  <p>I'm not really sure, that all what i've done is correct. I'm getting the warning in Player Class:</p>
  <blockquote>
  <p>This private field &quot;createdObjects&quot; is never assigned</p>
  </blockquote>
  <p>Should i change smtg, or just ignore the warning ?</p>
  <p>Here's the code :</p>
  <pre><code>public class Player {
  
      private ArrayList&lt;Objects&gt; createdObjects;
  
      public Player(ArrayList&lt;Objects&gt; createdObjects) {
         //Originally i have many other elements in this constructor
         // but i let only what concerns this arrayList
      }
   
      public ArrayList&lt;Objects&gt; getCreatedObjects() {
          return createdObjects;
      }
  }
  </code></pre>
  <pre><code>public class Adventure {
  
      private ArrayList&lt;Objects&gt; createdObjects = new ArrayList&lt;&gt;();
  
      public ArrayList&lt;Objects&gt; getCreatedObjects() {
          return createdObjects;
      }
  
      // ...methods that will add/modify... the arraylist
  
          public Player letsStart(){
              Player player = new Player(createdObjects);
              return player;
          }
      }
  
  </code></pre>