This content has been marked as final. Show 3 replies
Because its actual class is TreeSet. The Set interface just defines subSet to return NavigableSet.
you mean the object returned is treeset bysubset
Yes. Otherwise you'd get a ClassCastException.
But as far as the Set interface is concerned, it needs to return a NavigableSet.
Of course you can't rely on subSet always returning a TreeSet, you understand that don't you?