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 decd597 commit 7ddbe07Copy full SHA for 7ddbe07
src/main/java/com/thealgorithms/scheduling/SpeculativeExecutionScheduling.java
@@ -36,11 +36,23 @@ public SpeculativeExecutionScheduling() {
36
taskGroups = new HashMap<>();
37
}
38
39
+ /**
40
+ * Adds a task to the specified group.
41
+ *
42
+ * @param groupName the name of the group
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));
48
49
50
51
+ * Executes the tasks in the specified group.
52
53
54
+ * @return the name of the task that completed successfully
55
56
public String executeTasks(String groupName) {
57
List<Task> tasks = taskGroups.get(groupName);
58
if (tasks == null) {
0 commit comments