This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
O. Ziggy wrote:
I looked at the API and it is saying that TreeSet.headSet returns a NavigableSet<E> which has just confused me even more.
NavigableSet is an interface that is implemented by the TreeSet class. A TreeSet IS-A NavigableSet. A NavigableSet is not necessarally a TreeSet. So... it may be a good idea to use NavigableSet instead, as the headSet() method may not always return an object that may be casted to TreeSet, in future implementations.