Exercises

19.3Define each of the following terms:
  1. Collection

  2. Collections

  3. Comparator

  4. List

  5. load factor

  6. collision

  7. space–time trade-off in hashing

  8. HashMap

19.4Explain briefly the operation of each of the following methods of class Vector:
  1. add

  2. insertElementAt

  3. set

  4. remove

  5. removeAllElements

  6. removeElementAt

  7. firstElement

  8. lastElement

  9. isEmpty

  10. contains

  11. indexOf

  12. size

  13. capacity

19.5Explain 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.
19.6By extending class Vector, Java’s designers were able to create class Stack quickly. What are the negative aspects of this use of inheritance, ...

Get Java™ How to Program, Seventh 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.