title: Java one liner for loop
body: <p><a href="https://stackoverflow.com/questions/40505423/python-iterators-one-liner-for-loop">Here</a>, someone made a one-liner <code>for</code> loop in Python.</p>
  
  <p>Another example is this:</p>
  
  <pre><code>someList = [f(i) for i in range(16)]
  </code></pre>
  
  <p>which would be a one-liner for this code:</p>
  
  <pre><code>someList = []
  for i in range(16):
      someList.append(f(i))
  </code></pre>
  
  <p>or, in Java:</p>
  
  <pre><code>int[] someList = {}
  for (int i = 0; i &lt; 16; i++) {
      someList = append(someList, f(i));
  }
  </code></pre>
  
  <p>such that <code>f</code> is some function that will return an integer.</p>
  
  <p>Now, is there an equivalent one-liner in Java?</p>
  
  <blockquote>
    <p>Note: Currently, I am using Processing, which is similar to Java, so, any code written in Java might be usable in Processing.</p>
  </blockquote>