Skip to content

YuriiJavaDev/JavaBasics_Task_449_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Task Scheduler: Map Iteration (JavaBasics_Task_449_V0.1)

📖 Description

Efficient scheduling requires a clear mapping between descriptors and their numerical values. This project demonstrates the use of a HashMap to associate the days of the week with their ordinal numbers. The core focus is on Collection Iteration, specifically using the entrySet() method. This approach allows access to both the key and the value simultaneously during a single loop, providing a clean and efficient way to format and display associated data for the end user.

📋 Requirements Compliance

  • Key-Value Mapping: Successfully associated String keys (Day names) with Integer values (Day numbers).
  • Efficient Iteration: Used Map.Entry to traverse the collection, avoiding redundant lookups by key.
  • Formatted Presentation: Implemented custom string formatting to match the "Day: [Name], Number: [Value]" requirement.
  • Type Safety: Utilized Generics to ensure data consistency within the HashMap.

🚀 Architectural Stack

  • Java 8+ (Collections Framework, Map.Entry)

🏗️ Implementation Details

  • SchedulerApp: The main class responsible for populating the map and executing the formatted output logic.

📋 Expected result

Day: Monday, Number: 1
Day: Tuesday, Number: 2
Day: Wednesday, Number: 3

💻 Code Example

Project Structure:

JavaBasics_Task_449/
├── src/
│   └── com/yurii/pavlenko/
│                 └── app/
│                     └── SchedulerApp.java
├── LICENSE
├── TASK.md
├── THEORY.md
└── README.md

Code

package com.yurii.pavlenko.app;

import java.util.HashMap;
import java.util.Map;

public class SchedulerApp {

    public static void main(String[] args) {

        Map<String, Integer> weekDays = new HashMap<>();

        weekDays.put("Monday", 1);
        weekDays.put("Tuesday", 2);
        weekDays.put("Wednesday", 3);

        for (Map.Entry<String, Integer> entry : weekDays.entrySet()) {
            System.out.println("Day: " + entry.getKey() + ", Number: " + entry.getValue());
        }
    }
}

⚖️ License

This project is licensed under the MIT License.

Copyright (c) 2026 Yurii Pavlenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...

License: MIT

About

This is a tutorial project. JavaBasics_Task_449_V0.1 Task Scheduler: implementing a Map to associate weekdays with numbers and using entrySet for custom formatted output. 110526_1321

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages