Different Kinds of Streams 5 - lazily iterate a list of strings map the values convert to Int find max
suggest change// Java:
Stream.of("a1", "a2", "a3")
.map(s -> s.substring(1))
.mapToInt(Integer::parseInt)
.max()
.ifPresent(System.out::println); // 3
// Kotlin:
sequenceOf("a1", "a2", "a3")
.map { it.substring(1) }
.map(String::toInt)
.max().apply(::println)
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents