Any chance to see EnumSet implement SortedSet in JDK8?

mike.skells at talk21.com mike.skells at talk21.com
Fri Aug 12 18:16:24 UTC 2011


Hi David,
It doesn't work really in the general case because of wrapper classes

Collections.unmodifyableCollection(c) for instance need to infer the characteristics from the content

It could be a default implementation though

Regards
Mike
------Original Message------
From: David Schlosnagle
To: Rémi Forax
Cc: Mike Skells
Cc: core-libs-dev at openjdk.java.net
Subject: Re: Any chance to see EnumSet implement SortedSet in JDK8?
Sent: 12 Aug 2011 17:24

On Fri, Aug 12, 2011 at 9:06 AM, Rémi Forax <forax at univ-mlv.fr> wrote:
> On 08/12/2011 02:46 PM, mike.skells at talk21.com wrote:
>>
>> Hi Remi,
>> Your argument is flawed
>>
>> The complexity of the operations is not defined by the interface or the
>> presence or absence of the interface
>
> In theory yes, but in practice ...
> What is the purpose of java.util.RandomAccess ?
>
>> If you have complexity algo checks then these can only be applied to known
>> classes where the complexity is defined in the interface or class
>>
>> As such the code that infers this behaviour is broken and needs to be
>> fixed.
>
> Ok, how to remove the instanceof RandomAccess in Collections.shuffle (by
> example).

Does anyone know if there has ever been a proposal or experiments to
use annotations to provide algorithmic complexity information for a
given method implementation? This might be an interesting experiment
rather than adding marker interfaces that apply to an entire class.

- Dave


Sent from my BlackBerry® wireless device


More information about the core-libs-dev mailing list