Код: Выделить всё
String[] names = {"Sam","Pamela", "Dave", "Pascal", "Erik"};
List nameList;
Stream indices = intRange(1, names.length).boxed();
nameList = zip(indices, stream(names), SimpleEntry::new)
.filter(e -> e.getValue().length() c.Length
Подробнее здесь: [url]https://stackoverflow.com/questions/18552005/is-there-a-concise-way-to-iterate-over-a-stream-with-indices-in-java-8[/url]