Thompson Rivers University
Module 4 Lab 4: Collections
Lab 4 Collections - SM 2025In this lab, you’ll work with Java generics and basic array utilities to understand how collections can store and manipulate data. Specifically, you will:
Learn how to use a generic
Pairclass to store two related valuesModify that
Pairso both values share the same typeAdd a method to swap the two stored values
Explore built-in methods in
java.util.Arraysto create, copy, sort, and search arrays
These exercises build foundational skills for working with Java collections—knowing how to define and use generic classes, and using helper methods to manage arrays efficiently. You don’t need to open the PDF to begin: each question below explains what you must do, why it matters, and how to approach it step by step.
Keep reading this lesson
You've reached the end of the free preview. Unlock the rest of this lesson plus 54 more lessons in Thompson Rivers University.
- Unlimited coding questions
- Unlimited access to all classroom material
- Weekly live call for questions and guidance
- 3,000 AI tutor tokens / month
- Personal SQL database (3 MB)
- Progress tracking
Cancel any time.