upload
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m37s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m37s
This commit is contained in:
@@ -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());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user