HackIndia Logo
HackathonsNewsSkillsGrowth
HackIndia LogoContact: +91 9910125804

General

  • Companies
  • Colleges
  • Board of Advisors
  • Brand Ambassadors
  • FAQ
  • Contact
  • Report a Bug

Hackathons

  • Upcoming Hackathons
  • Judges
  • Mentors
  • Partners
  • Participating Colleges
  • Testimonials

Resources

  • About Us
  • Branding
  • Latest News
  • Growth
  • Skills
  • Builders
  • Ecosystem
  • Forum
  • Ideas
  • Prompt Optimizer
  • Games

© 2026 HackIndia. All rights reserved.

Privacy PolicyTerms of ServiceCode of ConductSitemap

Build 2.139 · 05 Nov 2026, 10:27 UTC

    HackIndia
    HackathonsNewsInternshipsSkillsGrowthPro Perks
    OpenJDKWorking towardsJava
    0%

    0 of 10 steps done · +100 XP · +50 SHARP when it is yours

    1. 1Java project worth showing5 min · +10 XP · +5 SHARP
    2. 2Types and collections4 min · +10 XP · +5 SHARP
    3. 3Classes and interfaces5 min · +10 XP · +5 SHARP
    4. 4Generics and exceptions4 min · +10 XP · +5 SHARP
    5. 5Streams and lambdas4 min · +10 XP · +5 SHARP
    6. 6Files and JSON handling4 min · +10 XP · +5 SHARP
    7. 7Maven or Gradle basics4 min · +10 XP · +5 SHARP
    8. 8Submit your public repo4 min · +10 XP · +5 SHARP
    9. The check10 questions, 7 to pass · +10 SHARP
    10. Hand in the taskA project that uses the skill
    11. Skill and certificate+100 XP · +50 SHARP
    Lesson 2 of 8 4 min

    Java

    Types and collections

    • +10 XP for this lesson
    • +100 XP when the skill is proved
    • Nobody here has proved it yet
    In 30 seconds
    • Pick Java types that match recruiter data without overbuilding.
    • Use List, Set, and Map for jobs, skills, and lookups.
    Add small collection logic your CLI can show later.
    Key point

    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.

    Example

    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

    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.

    Tip

    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.

    Your to-do

    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

    Quick check

    0 of 2 right
    1.Your candidate has skills Java, SQL, Java. Which collection should you use to avoid duplicates?
    2.You need to find the number of openings for a recruiter name. Which collection fits best?

    Answer the quick check to finish this lesson.

    ← Lesson 1Skip to lesson 3 →
    OpenJDK
    Working towards
    Java +100 XP

    0 of 8 lessons done · proved by a project that uses the skill

    See the track