title: compare Integers using .stream() in java
body: <p>I have an ArrayList and another int that come from the console.
  I want to find the closest number larger than those int in the list using stream().
  Why this doesn't work:</p>
  
  <pre><code>Scanner scn = new Scanner(System.in);
  int numOfRows = scn.nextInt();
  int nextNumber = scn.nextInt();
  for (int i = 0; i &lt; numOfRows; i++) {
      String[] input = scn.nextLine().split(" ");
      ArrayList&lt;Integer&gt; nums = new ArrayList&lt;&gt;();
      for (int j = 0; j &lt; input.length; j++) {
          nums.add(Integer.parseInt(input[j]));
      }
      nextNumber = nums.stream().filter(x -&gt; x &gt; nextNumber).findFirst();
      System.out.println(nextNumber); 
  }
  </code></pre>