Chapter 4 Notes
Style: We will use singular identifiers for all collections: student, not students; file, not files; etc.
Generic classes:
- require a type parameter when used in a declaration
- object references declared with one type cannot be assigned objects declared with a different type
Numbering of collections:
- the index can be thought of as an offset from the beginning
ArrayLists, unlike arrays, can remove elements; this causes the indexes of the remaining elements to change
for-each loop:
- cannot add or remove elements of the the collection within the loop body
- do not make available an index value for each iteration; the index value is internal to the loop’s control
- number of iterations equals the number of collection elements
- a definite iteration: the number of executions of the loop body is known in advance
touque.ca > Education Commons > Java > Resources
[This page last updated 2020-12-23 at 12h13 Toronto local time.]

© 2007–2025 Hersch, Bear & Company Limited. All rights reserved. “Grammar Authority,” “grammarauthority.com,” “touque.ca,” and “Canada’s Thinking Cap” are trademarks of Hersch, Bear & Company Limited. All other trademarks and copyrights are the property of their respective owners.
Privacy Policy | Licence to Copy | How to cite | Contact us
