title: Inline Array Definition in Java
body: <p>Sometimes I wish I could do this in Java:</p>
  
  <pre><code>for (int i : {1, 2, 3, 4, 5})
      System.out.println(i);
  </code></pre>
  
  <p>Unfortunately, I have to do something like this   instead:</p>
  
  <pre><code>int [] i = {1, 2, 3, 4, 5};
  // ...
  </code></pre>
  
  <p>My recollection is that C++ has this sort of feature. Is there an OOP replacement for inline array definitions (maybe even to the point of instantiating anonymous classes)?</p>