> On May 26, 2016, at 1:57 PM, Stuart Marks <stuart.ma...@oracle.com> wrote:
> :
> 
> However, the existing implementation permits removal only; it already 
> prohibits addition. Making the returned set unmodifiable would break clients 
> that only remove elements from the returned set. I can imagine use cases that 
> would do this, but it seems like they'd be quite rare.
> 

Thanks for looking at existing usages and fixing this issue.  Yup since the 
existing impl throws UOE at addition, I agree that the compatibility risk of 
changing the returned set to unmodifiable is not high. 

> 
> -        return h.keySet();
> +        return Set.of(h.keySet().toArray(new String[0]));
>     }

The patch looks fine.  It’d be good to add a test case.

If you use Collections.unmodifiableSet, you would not need to convert the key 
sets to an array. Any benefit of using Set::of instead of 
Collections.unmodifiableSet?

Mandy

Reply via email to