The NavigableSet API docs state that methods headSet
,tailSet(E)
,headSet(E)
and subSet(E, E)
return a NavigableSet
.
In Eclipse,开发者_高级运维 I get a type mismatch error, although I use the 1.6_20 jdk and have my compiler compliance set to 1.6, so I have to "downgrade" the return value to SortedSet
.
Am I missing something?
You may have misread the javadoc. There two headSet methods, one returns SortedSet and the other returns NavigableSet. The same for the other methods you mentioned.
精彩评论