I have the following list:
var list = Arrays.asList("a", "b", "c");
I want to achieve something like that:
// "a, "
// "b, "
// "c"
So I did that:
var formattedList = list.stream()
.map(el -> el + ", ")
.collect(Collectors.toList());
It is working almost fine:
// "a, "
// "b, "
// "c, "
but as you can see I don't know how to "ommit" last element in my stream.
Could someone help me achieve that?