Lesson 6 of 628 minModule progress 0%

Module 11: Collections Framework in Practice

Mini-Project: Contact Manager

Build a contact manager that combines lists, maps, and sorting in one small program.

Author

Java Learner Editorial Team

Reviewer

Technical review by Java Learner

Last reviewed

2026-04-17

Java version

Java 25 LTS

How this lesson was prepared: AI-assisted draft, manually edited for clarity, and checked against current Java documentation and runnable examples.

Learning goals

  • Combine several collection types in one design
  • Choose storage based on actual access patterns
  • Produce filtered and sorted contact views

Project goal: Store contacts, prevent duplicate tags, look up by ID, and print sorted views by name or city.

Suggested collection choices: A map for ID lookup, a set for unique tags, and a list when you need ordered display output.

What to practice: Adding, updating, searching, sorting, and converting between collection types when needed.

Success check: Your chosen collection types should match the job instead of all data being shoved into one giant list.

Runnable examples

A map handles direct contact lookup

java.util.Map<Integer, String> contacts = new java.util.HashMap<>();
contacts.put(1, "Ada Lovelace");
System.out.println(contacts.get(1));

Expected output

Ada Lovelace

Mini exercise

Start with ID lookup and unique tags first, then add sorted output afterward.

Summary

  • Good collection design follows the access pattern.
  • One project can legitimately use several collection types together.
  • This module is about choosing structures intentionally, not memorizing every API method.

Next step

Next comes generics, which make collection-heavy code safer and more reusable.

Sources used

Advertisement

Lesson check

What should guide the data structure choices in the contact manager?

Next lesson →