On 15/05/13 12:02, Alan Bateman wrote:
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();
well spotted and that's a simpler way of doing it. I messed the change
up from the previous revision.
It's unfortunate the actual end to end HttpURLConnection tests only use
one header in each
request. So, they didn't catch that. I'll update the test as well.
Thanks
Michael
I'll post one more webrev, and push it soon afterwards as I'd like to
make the
code freeze today.
Okay.