Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
Description
After re-assigning existing active tasks to clients that previously had the same active task, there is chance that taskIds.size() == assigned.size(), i.e. all tasks are assigned .
The method continues with:
final Set<TaskId> unassigned = new HashSet<>(taskIds); unassigned.removeAll(assigned);
We can check the above condition and return early before allocating HashSet.
Similar optimization can be done before the following (around line 112):
// assign any remaining unassigned tasks final List<TaskId> sortedTasks = new ArrayList<>(unassigned);