Answers to Self-Review Exercises
a) Iterator
.
b) index.
c) autoboxing.
d) ArrayList
, Vector
.
e) double.
f) unmodifiable wrapper.
g) auto-unboxing.
h) disjoint
.
a) False. Autoboxing occurs when adding a primitive type to a collection, which means the primitive type is converted to its corresponding type-wrapper class.
b) False. A Set
cannot contain duplicate values.
c) False. A Map
cannot contain duplicate keys.
d) True.
e) False. Collections
is a class
; Collection
is an interface
.
f) True.
g) False. As the load factor increases, fewer slots are available relative to the total number of slots, so the chance of a collision increases.
h) False. Attempting to insert a null
element causes a NullPointerException
.
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.