Java How to Program学习笔记_第十六章_Java集合(Generic Collections)——自测题(Self Review)

 

Self-Review Exercises

16.1 Fill in the blanks in each of the following statements:

a) A(n) Iterator is used to iterate through a collection and can remove elements from the collection during the iteration.

b) An element in a List can be accessed by using the elements index .

c) Assuming that myArray contains references to Double objects, auto-boxing occurs when the statement "myArray[0] = 1.25;" executes.

d) Java classes ArrayList and Vector provide the capabilities of arraylike data structures that can resize themselves dynamically.

e) If you do not specify a capacity increment, the system will double the size of the Vector each time additional capacity is needed.

f) You can use a(n) unmodifiable wrapper to create a collection that offers only read-only access to others

while allowing read–write access to yourself.

g) Assuming that myArray contains references to Double objects, auto-unboxing occurs when the statement "double number = myArray[0];" executes.

h) Collections algorithm disjoint determines if two collections have elements in common.

16.2 Determine whether each statement is true or false. If false, explain why.

a) Values of primitive types may be stored directly in a collection. (F)

b) A Set can contain duplicate values. (F)

c) A Map can contain duplicate keys. (F)

d) A LinkedList can contain duplicate values. (T)

e) Collections is an interface. (F)

f) Iterators can remove elements. (T)

g) With hashing, as the load factor increases, the chance of collisions decreases. (T)

h) A PriorityQueue permits null elements. (F)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值