title: In clear terms what is an ArrayList and how to use it?
body: <p>If I look up what an ArrayList is and how to use it I often get confused. I get scared when I look at this for example:</p>
  
  <pre><code>new ArrayList&lt;Element&gt;(Arrays.asList(array))
  </code></pre>
  
  <p>I probably have a few gaps in my understanding of ArrayLists as a beginner. For example: What does <code>&lt;&gt;</code> stand for? Does it have special meaning? How is it internally represented? (For example: I see variables as representing a place in memory, array variables as a starting position in memory and an index of an array as a way to say how much further to go from this starting position.)</p>
  
  <p><strong>An example of where I think I need an ArrayList:</strong>
  <em>(I was trying to create an array of integers of user-input. The user-input is one integer at a time, the end condition is when the user inputs a zero <code>endSign = 0</code>.)</em> Since Java doesn't allow re-sizing of an array after its creation, I searched for a solution to create an array of a dynamic length. ArrayList seems to be an option if I convert it to an array at the end, if I understand that correctly? If that's the case than it would be probably useful to make use of an ArrayList here:</p>
  
  <pre><code>    private int[] userInput(int endSign){ //end-sign is 0 in this case
      int validInputCounter=0;
      List&lt;int&gt; userValues;
      int value;
      do{
          value = readInt(); //reads integer user-input
          if(value != endSign){ 
              validInputCounter++;
              userValues += value;  
          }else{
          break;
          }
      }while(true);
      return userValues;  
  }
  </code></pre>
  
  <p>In this code I want to return an int[] array of values that the user put in.</p>