I have a list which I need to iterate on the basis of certain conditions as below:
StringBuilder sb = new StringBuilder();
list.stream().forEach(l-> {
if(l.contains("(")){
sb.append("a");
} else
sb.append("b");
});
How to do the same operation using filter of stream.
Collections.joiningas with transformation undermapasl.contains("(") ? "a" : "b"once you stream.