Reducciones "Mutable"

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

REDUCCIONES

"MUTABLE"
String p = Stream.of("b","c","a")
.sorted()
.reduce("",String::concat);

Problema: poco eficiente


Stream<String> stream = Stream.of("a","b","c");

StringBuilder sb = new StringBuilder();


stream.forEach(s->sb.append(s));
void forEach(Consumer<? super T> action);

You might also like