Exercises

16.3 Define each of the following terms:

a) Collection

b) Collections

c) Comparator

d) List

e) load factor

f) collision

g) space/time trade-off in hashing

h) HashMap

16.4 Explain briefly the operation of each of the following methods of class Vector:

a) add

b) set

c) remove

d) removeAllElements

e) removeElementAt

f) firstElement

g) lastElement

h) contains

i) indexOf

j) size

k) capacity

16.5 Explain why inserting additional elements into a Vector object whose current size is less than its capacity is a relatively fast operation and why inserting additional elements into a Vector object whose current size is at capacity is a relatively slow operation.

16.6 By extending class Vector, Java’s designers were able to create class Stack quickly. ...

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.