Is there a shorter, maybe one way liner, write the following:
ArrayList<Integer> myList = new ArrayList<>(); for (int i = 0; i < 100; i++){ myList.add(i); }
Using Java 8 features and functionally unused approaches. I do not expect a Haskell solution, for example:
ls = [1..100]
But something more elegant than the traditional imperative style.
source share