Code review: 8010464: Evolve java networking same origin policy

Alan Bateman Alan.Bateman at oracle.com
Wed May 15 04:02:20 PDT 2013


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/net-dev/attachments/20130515/13f61073/attachment.html 


More information about the net-dev mailing list