title: Comparing List<Integer> by index
body: <pre><code>    List&lt;Integer&gt; listOne= new ArrayList&lt;&gt;();
      listOne.add(10);
      listOne.add(2);
      listOne.add(3);
  
      //Second Array
  
      List&lt;Integer&gt; listTwo= new ArrayList&lt;&gt;();
      listTwo.add(3);
      listTwo.add(7);
      listTwo.add(1);
  </code></pre>
  
  <p>I want to compare two List and give point to <code>listOne</code>or <code>listTwo</code> depending on which value is greater</p>
  
  <pre><code>[10, 2, 3] compare to [3, 7, 1]
  if listOne.get(0) &gt; listTwo.get(0) //add one point to listOne
  
  if listOne.get(0) &lt; listTwo.get(0) //add one point to listTwo
  </code></pre>
  
  <p>Here is my tested code</p>
  
  <pre><code>    static List&lt;Integer&gt; compareList(List&lt;Integer&gt; a, List&lt;Integer&gt; b) {
          ArrayList&lt;Integer&gt; output = new ArrayList&lt;&gt;();
          output.add(0, 0);
          output.add(1, 0);
          int out = output.get(0);
          int out2 = output.get(1);
          for (int i = 0; i &lt; a.size(); i++) {
              if (a.get(i) &gt; b.get(i)) {
                  out = out + 1;
              } 
              if (a.get(i) &lt; b.get(i)) {
                  out2 = out2 + 1;
              } 
          }
  
          output.add(0, out);
          output.add(1, out2);
          return output;
  
      }
  </code></pre>
  
  <p>It works, but its not outputting the expected answer</p>
  
  <blockquote>
    <p>expected output : 2 1
    output am getting : 2 1 0 0</p>
  </blockquote>