On 15/05/2013 11:34, Michael McMahon wrote:
:

On MessageHeader then getHeaderNamesInList could use java.util.StringJoiner to avoid rolling your own.


I can see the benefit of using StringJoiner (and a lambda) if I am starting off from a Collection and this is something that only struck me when looking at this. I was surprised to see that Arrays.asList() doesn't have a variant that limits the number of elements coming from the array. So, I can't use it here. Maybe this is something
we could look at again later, with the other changes we're contemplating?
I think getHeaderNamesInList needs to be checked anyway as it looks to me that it just appends the keys and will never insert a comma.

The only reason I suggested StringJoiner here is because I thought this method was trying to do this:

StringJoiner joiner = new StringJoiner(",");
for (int i=0; i<nkeys; i++) {
    joiner.add(keys[i]);
}
return joiner.toString();


I'll post one more webrev, and push it soon afterwards as I'd like to make the
code freeze today.
Okay.

Reply via email to