Design and implement a ToDo list system for managing AI tasks. The system maintains a collection of tasks where each task has a unique identifier, a description, and a current status.
Implement the ToDoList class:
-
ToDoList()Initializes an empty task list. -
void add(String taskId, String description, String status)Adds a new task with the given identifier, description, and initial status. -
List<String> get(String taskId)Retrieves task information as a list in the format[taskId, description, status]. Returns an empty list if the task does not exist.
void updateStatus(String taskId, String newStatus)Changes the status of an existing task to the specified new status.
Each task is represented as a three-element list containing the task ID, description, and current status. Valid status values are "READY", "IN_PROGRESS", "SUCCEEDED", and "FAILED".
Constraints:
- 1 ≤
taskId.length,description.length≤ 100 - Each
taskIdis unique within the list - All string inputs are non-null and non-empty
- The number of operations will not exceed 104
Example
Input: ["ToDoList", "add", "add", "get", "updateStatus", "get", "get"] [[], ["task1", "Implement login", "READY"], ["task2", "Write tests", "IN_PROGRESS"], ["task1"], ["task1", "IN_PROGRESS"], ["task1"], ["task3"]]
Output: [null, null, null, ["task1", "Implement login", "READY"], null, ["task1", "Implement login", "IN_PROGRESS"], []]
Explanation:
ToDoList todoList = new ToDoList();todoList.add("task1", "Implement login", "READY");todoList.add("task2", "Write tests", "IN_PROGRESS");todoList.get("task1");// Returns ["task1", "Implement login", "READY"]. Retrieve task "task1".todoList.updateStatus("task1", "IN_PROGRESS");/todoList.get("task1");// Returns ["task1", "Implement login", "IN_PROGRESS"].todoList.get("task3");// Returns [].
