Move logger's anonymous runnable to lambda
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bea 2022-08-26 01:15:57 +02:00
parent 59c5e09f14
commit 76c2c9e171

View File

@ -47,16 +47,8 @@ public class Logger
public void log(String message, int delay) public void log(String message, int delay)
{ {
// create a new scheduled executor with an anonymous runnable... // create a new scheduled executor with an anonymous runnable...
Executors.newSingleThreadScheduledExecutor().schedule(new Runnable() //... after waiting <delay> seconds.
{ Executors.newSingleThreadScheduledExecutor().schedule(() -> log(message), delay, TimeUnit.SECONDS);
@Override
public void run()
{
// log the message
log(message);
}
//... after waiting X seconds.
}, delay, TimeUnit.SECONDS);
} }