Any chance to see EnumSet implement SortedSet in JDK8?

Rémi Forax forax at univ-mlv.fr
Fri Aug 12 20:22:47 UTC 2011


On 08/12/2011 08:21 PM, mike.skells at talk21.com wrote:
> Hi Remi
> That is precisely my point
> The specification of RandomAccess defines the non functional behaviour so you are not inferring it you are using the specification
>
> You cannot assume that a list that does not implement RA has any preferred iteration characteristics though

Shuffle doc says that it run in linear time.
You can't guarantee that if there is no guarantee that:
   - toArray() run in linear time and listIterator.set run in constant time
   - RandomAccess list get/set run in constant time

You will no find such guarantees in the spec.
So practically, you have to 'infer' it.

> Regards
> Mike

Regards,
Rémi

> ------Original Message------
> From: Rémi Forax
> To: 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 14:06
>
> 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).
>
>> If the arbitrary missasumptions as to non functional characteristics is the driver that blocks evolution of the java ecosystem then java is dead and we may as well keep starting again.
> Common misconception, if Java was blocked it was because Sun was dying,
> not because Java has a strong tradition of backward compatibility.
> You can always built a new package like java.nio if the old one block
> your evolution.
>
>> As an aside IMO the complexity specification issue could be better addressed with the interface evolution in Java 8. There have been other discussion of improvements to performance of the algos in collections that do require this metadata. This would allow the broken code to be fixed
>>
>> Regards
>> Mike
>> Sent from my BlackBerry® wireless device
> regards,
> Rémi
>
>
>
> Sent from my BlackBerry® wireless device




More information about the core-libs-dev mailing list