Skip to content

Commit 7777f53

Browse files
committed
Fix
1 parent fe199d4 commit 7777f53

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/thealgorithms/scheduling/SpeculativeExecutionScheduling.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public SpeculativeExecutionScheduling() {
4343
* @param taskName the name of the task
4444
*/
4545
public void addTask(String groupName, String taskName) {
46-
taskGroups.putIfAbsent(groupName, new ArrayList<>());
47-
taskGroups.get(groupName).add(new Task(taskName));
46+
List<Task> tasks = taskGroups.computeIfAbsent(groupName, k -> new ArrayList<>());
47+
tasks.add(new Task(taskName));
4848
}
4949

5050
/**

0 commit comments

Comments
 (0)