Community
Participate
Working Groups
Right now eclipse provides some code templates to iterate a variable using for and foreach (for (int i: array)). It would be nice to support code templates iterating using the JDK 8 streams API.
Example using Arrays: int[] array = { 1, 2, 3, 4, 5, 4, 3, 2, 1 }; Arrays.stream(array).forEach(System.out::println);
In my understanding, most support for stream processing is already covered by code completion, since most stream processing follows a fluent pattern. So, what should the template produce? Input: array Output: Arrays.stream(array) ? I don't think that forEach is more relevant than any other method on Stream, is it?
I believe it should produce Arrays.stream(array).forEach(); and place the cursor inside the forEach parameter, just like the for code completion templates do.
(In reply to George Gastaldi from comment #3) > I believe it should produce Arrays.stream(array).forEach(); and place the > cursor inside the forEach parameter, just like the for code completion > templates do. Why should a template favor forEach over any other method of Stream?
I see that as an evolution to the for-each statement. Obviously that is not so clear unless there is a code template to help