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 Regards Mike ------Original Message------ From: Rémi Forax To: Mike Skells Cc: [email protected] Subject: Re: Any chance to see EnumSet implement SortedSet in JDK8? Sent: 12 Aug 2011 14:06 On 08/12/2011 02:46 PM, [email protected] 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
