One idea
Types protect meaning. Collections protect structure. In a recruiter CLI, use simple types for one value and collections for many values.
Use the right type
A job title is a String. Years of experience is an int. A salary range can start as two int values in rupees per month. A yes/no field, like remote allowed, is a boolean.
Avoid storing everything as String just because input comes from the terminal or a CSV file. Convert early, then the rest of your code becomes easier to trust.
Choose collections
Use a List when order matters or duplicates are allowed. Job applications in the order they were loaded can be a List.
Use a Set when duplicates should not exist. A candidate’s skills are a Set because Java should appear once, not five times.
Use a Map when you need fast lookup by a key. Recruiter name to open job count can be a Map.
Recruiter data example
This is not the final class design. That comes in the next lesson. For now, see how types and collections shape the data.
import java.util.*;
public class RecruiterDataDemo {
public static void main(String[] args) {
String candidateName = "Asha Mehta";
int experienceYears = 1;
boolean openToRelocation = true;
List<String> jobTitles = new ArrayList<>();
jobTitles.add("Java Intern");
jobTitles.add("Backend Intern");
jobTitles.add("Software Developer Trainee");
Set<String> skills = new HashSet<>();
skills.add("Java");
skills.add("SQL");
skills.add("Java"); // duplicate is ignored
Map<String, Integer> recruiterOpenings = new HashMap<>();
recruiterOpenings.put("Zoho", 3);
recruiterOpenings.put("Razorpay", 2);
recruiterOpenings.put("Local Startup", 1);
System.out.println(candidateName + " has skills: " + skills);
System.out.println("Jobs loaded: " + jobTitles.size());
System.out.println("Zoho openings: " + recruiterOpenings.get("Zoho"));
}
}Common mistake
Do not use ArrayList for everything. It works at first, then your code becomes messy when you need uniqueness or lookup.
If you often ask “does this skill exist?”, use Set. If you often ask “what value belongs to this key?”, use Map.
Let AI help safely
You can ask an AI tool: “Suggest Java types and collections for a CLI app that stores candidates, skills, jobs, and recruiters.” Then check the answer yourself.
Reject designs that are too advanced for now, like databases, web APIs, or many patterns. This lesson only needs primitive types, String, List, Set, and Map.
Do this now
Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.
0 of 5 done