We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe199d4 commit 7777f53Copy full SHA for 7777f53
src/main/java/com/thealgorithms/scheduling/SpeculativeExecutionScheduling.java
@@ -43,8 +43,8 @@ public SpeculativeExecutionScheduling() {
43
* @param taskName the name of the task
44
*/
45
public void addTask(String groupName, String taskName) {
46
- taskGroups.putIfAbsent(groupName, new ArrayList<>());
47
- taskGroups.get(groupName).add(new Task(taskName));
+ List<Task> tasks = taskGroups.computeIfAbsent(groupName, k -> new ArrayList<>());
+ tasks.add(new Task(taskName));
48
}
49
50
/**
0 commit comments