Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 1 KB

File metadata and controls

45 lines (34 loc) · 1 KB

SchedulerAPI

Simple API for scheduling tasks - here's how to use it.

Reapting Tasks

SchedulerAPI.scheduleRepeat(() -> 
    System.out.println("Hello world, it's been a second!");
), 1000);

This method allows you to schedule a repeating task with an interval.

Repeating Task if Condition

boolean condition = true;
int i = 0;

scheduleRepeatIfTrue(() -> {
   System.out.println(i);
   i++;
}, 1000, () -> condition);

This method allows you to schedule a repeating task with an interval if a condition is true.

Schedule After

SchedulerAPI.scheduleAfter(() -> {
   System.out.println("Hello world, it's been a second!");
}, 1000);

This method will execute a task after a specific amount of time.

Schedule After if Condition

boolean condition = true;
SchedulerAPI.scheduleAfter(() -> {
   System.out.println("Hello world, it's been a second!");
}, 1000, () -> condition);

This method will execute a task after a specific amount of time if a condition is true.