title: ArrayList and the sort Method of Collections
body: <p>this method is supposed to iterate on the TreeMaps keys. Then it should add the key to an ArrayList variable because I need to return it as one. One more thing I want to do is to sort the ArrayList.</p>
  
  <pre><code>    ArrayList&lt;String&gt; getVehiclenames() {
           ArrayList&lt;String&gt; vehicleList = new ArrayList&lt;&gt;();
           for (String elem : vehicles.keySet()) {
               vehicleList.add(elem);
           }
      Collections.sort(vehicleList);
      return vehicleList;
  }
  </code></pre>
  
  <p>I am not 100%ly sure wether thats working, but I still couldnt believe anyways that calling a collections method just sort my vehiclelist like that. I expected something like vehicleList = Collections.sort(vehicleList);. </p>
  
  <p>My questions: Is this working like that? And if yes: How is that working? I tried to look it up but my knowledge is to norrow right now. </p>