Managing Records with Nested Maps and Lists in Java

Welcome! Today, we are going to explore an engaging task that involves managing employee records within a company. Specifically, we will work with nested maps and lists to add projects and tasks for employees and retrieve those tasks as needed. This exercise will help you understand how to manipulate hierarchical data structures efficiently using Java.

Introducing Methods to Implement

Let's start by discussing the methods we will implement in our EmployeeRecords class.

  • boolean addProject(String employeeId, String projectName) - This method adds a new project to an employee's list of projects. If the project already exists for that employee, the method returns false. Otherwise, it adds the project and returns true.
  • boolean addTask(String employeeId, String projectName, String task) - This method adds a new task to a specified project for an employee. If the project does not exist for that employee, the method returns false. If the task is added successfully, it returns true.
  • List<String> getTasks(String employeeId, String projectName) - This method retrieves all tasks for a specified project of an employee. If the project does not exist for that employee, the method returns . Otherwise, it returns the list of tasks.
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal