Replace concat String to append in StringBuilder parameters

Brian Goetz brian.goetz at oracle.com
Tue Aug 19 00:43:18 UTC 2014


What you should have written was:

   String s = whatever.stream().collect(joining(", "));

On 8/11/2014 1:31 PM, Pavel Rappo wrote:
> Sorry, I should've written this:
>
> 	  Iterable<?> whatever = ...
> 	  StringJoiner joiner = new StringJoiner(", ");
> 	  whatever.forEach(w -> joiner.add(w.toString()));
> 	  String s = joiner.toString();
>
> -Pavel
>
> On 11 Aug 2014, at 17:17, Pavel Rappo <pavel.rappo at oracle.com> wrote:
>
>> 	Iterable<?> whatever = ...
>> 	whatever.forEach(w -> builder.append(w.toString());
>> 	String s = builder.toString();
>



More information about the core-libs-dev mailing list