Collections.emptyList().sort() does nothing

Stuart Marks stuart.marks at oracle.com
Fri Nov 17 07:14:32 UTC 2017



On 11/15/17 11:52 PM, Tagir Valeev wrote:
>> While this isn't guaranteed by the spec, changing these at this point would be a behavioral incompatibility, so we're unlikely ever to change them.
> 
> But this behavior will not be specified as well, right?

I don't have any plans to change the docs to specify that these particular 
implementations allow calling a no-op mutator method (i.e., they do not throw an 
exception).

The Collection class specification allows for flexibility in how implementations 
deal with such cases. See the paragraph that begins «The "destructive" 
methods....» My copyOf proposal, recently reviewed, rewords this somewhat but 
keeps this flexibility.

s'marks


More information about the core-libs-dev mailing list