Say I want to create n items. Pre Java 8, I would write:
List list = new ArrayList<>(); for (int i = 0; i < n; i++) { list.add(new My
You could use Stream#generate with limit:
Stream.generate(MyClass::new).limit(10);