Skip to content

Commit

Permalink
Clarify "add job" expression
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Dailis <[email protected]>
  • Loading branch information
DavidLegg and mattdailis committed Feb 12, 2024
1 parent 990edf5 commit 7a3b8ff
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ public void schedule(final JobRef job, final TimeRef time) {

if (oldTime != null) removeJobFromQueue(oldTime, job);

this.queue.compute(time, (t, jobsAtNewTime) -> {
if (jobsAtNewTime == null) jobsAtNewTime = new HashSet<>();
jobsAtNewTime.add(job);
return jobsAtNewTime;
});
this.queue.computeIfAbsent(time, $ -> new HashSet<>()).add(job);
}

public void unschedule(final JobRef job) {
Expand Down

0 comments on commit 7a3b8ff

Please sign in to comment.