[concurrency-interest] Navigable{Map, Set} must not inherit fromSorted{Map, Set}

David Holmes dholmes at dltech.com.au
Sun Sep 4 09:09:36 EDT 2005


> Rémi Forax wrote:
> >
> >    void doSomething(Set<String> set) {
> >      if (set instanceof SortedSet)
> >        // before retrofitting:
> >        //   it's a tree set, or a wrapper on a tree set
> >        //   like unmodifiableSet(...)
> >        // after retrofitting:
> >        //   oups FastTraversalSet match
> >      else
> >        // it's my implementation
> >    }

Is there some reason you can't invert the test and check for your
implementation first? That way you don't care what interfaces it implements.

David Holmes



More information about the Concurrency-interest mailing list