title: How to dynamically create Lists in java?
body: <p>I'm programming in java for a class project.
  In my project I have airplanes, airports and passengers.</p>
  
  <p>The passenger destination airport is randomly created, but then I have to add it to a List with passengers for that destination. </p>
  
  <p>As long as the airports are read from a file thus they can vary, how can I create Lists according to these airports?</p>
  
  <p>What I want to do is something like:</p>
  
  <pre><code>List&lt;Passenger&gt; passengersToJFK = new ArrayList&lt;Passenger&gt;();
  .
  .
  .
  
  if(passenger.destination == "JFK"){
     passengersToJFK.add(passenger);
  }
  </code></pre>
  
  <p>The problem is that as I've said, the number and name of airports can vary, so how can I do a general expression that creates Lists according to the Airports File and then adds passengers to those Lists according to the passenger destination airport?</p>
  
  <p>I can get the number of Airports read from the file and create the same number of Lists, but then how do I give different names to this Lists?</p>
  
  <p>Thanks in advance</p>