Collections.emptyList().sort() does nothing

Tagir Valeev amaembo at
Thu Nov 16 07:52:32 UTC 2017


> My view is that it's preferable for collections implementations to be
> strict. If I'm handing out an unmodifiable List, it should always be illegal
> for the callee to attempt to sort it, even if it has zero or one elements.

Thank you, this totally makes sence.

> 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?

With best regards,
Tagir Valeev.

More information about the core-libs-dev mailing list