upload
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m37s

This commit is contained in:
Jan-Philipp Luithardt
2025-12-03 16:43:47 +01:00
parent 0bd55b0b0b
commit efa4cbe744
3 changed files with 35 additions and 2 deletions

View File

@@ -41,4 +41,18 @@ public class TaskManager {
}
return this.taskMap.get(taskID);
}
public void deleteTask(String name) {
if (name == null ) {
throw new IllegalArgumentException("Name is null!");
}
if(name.isEmpty() || this.taskMap.values().stream().anyMatch(t -> t.getName().equals(name))) {
throw new IllegalArgumentException("Wrong name!");
}
this.taskMap.remove(this.taskMap.values().stream().filter(t -> t.getName().equals(name)).findFirst()
.orElseThrow(() -> new IllegalArgumentException("Cant find a Task")).getTaskID());
}
}