Summary: | [templates] Support iteration of arrays using JDK 8 Streams | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | George Gastaldi <gegastaldi> |
Component: | Text | Assignee: | JDT-Text-Inbox <jdt-text-inbox> |
Status: | ASSIGNED --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P5 | CC: | daniel_megert, mistria, stephan.herrmann |
Version: | 4.7 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
George Gastaldi
2017-05-19 10:31:19 EDT
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 |