当前位置: 技术问答>java相关
scjp 真题一个???
来源: 互联网 发布时间:2015-03-11
本文导语: Q#9 what collection used when uniqueness rquired and retrieve in natural order 1-set 2-sortedset 3-map 4-collection 你们认为选那个 我不知道!!!! | Collection A basic interface that defines the operations that all the ...
Q#9 what collection used when uniqueness rquired and retrieve in natural order
1-set
2-sortedset
3-map
4-collection
你们认为选那个
我不知道!!!!
1-set
2-sortedset
3-map
4-collection
你们认为选那个
我不知道!!!!
|
Collection A basic interface that defines the operations that all the classes that maintain collections of objects typically implement.
Set Extends Collection, sets that maintain unique elements. Set interface is defined in terms of the equals operation
SortedSet Extends Set, maintain the elements in a sorted order
Map A basic interface that defines operations that classes that represent mappings of keys to values typically implement
我看2吧
Set Extends Collection, sets that maintain unique elements. Set interface is defined in terms of the equals operation
SortedSet Extends Set, maintain the elements in a sorted order
Map A basic interface that defines operations that classes that represent mappings of keys to values typically implement
我看2吧
|
其实问题的关键在于什么叫做natual order。
public interface Comparable
This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method.
上面是jdk中Comparable接口的文档,也就是按照Comparable中的compareTo方法比较
后出来的顺序是natual order.
很显然,答案是2。
public interface Comparable
This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method.
上面是jdk中Comparable接口的文档,也就是按照Comparable中的compareTo方法比较
后出来的顺序是natual order.
很显然,答案是2。
|
2