You need to create a class that will store some unique object elements. You do not need to sort these elements but they must be unique.
What interface might be most suitable to meet this need?
A. Set
B. List
C. Map
D. Vector
...全文
10813打赏收藏
问个基础问题
You need to create a class that will store some unique object elements. You do not need to sort these elements but they must be unique. What interface might be most suitable to meet this need? A. Set B. List C. Map D. Vector
对于问题1
javadocs上对Set的解释是:
A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element.
而对Map的解释是:
An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.
对于2,我刚才搜到一点解释
A native method is a Java method (either an instance method or a class method) whose implementation is written in another programming language such as C.