@@ -488,19 +488,19 @@ public void testThreadPoolScheduler() {
488488 advanceToRandomTime (taskQueue );
489489 final long startTime = taskQueue .getCurrentTimeMillis ();
490490
491- final Set <String > strings = new HashSet <>(5 );
492- final Set <ScheduledFuture <?>> scheduledFutures = new HashSet <>(5 );
491+ final List <String > strings = new ArrayList <>(5 );
492+ final List <ScheduledFuture <?>> scheduledFutures = new ArrayList <>(5 );
493493
494494 final long delayMillis = randomLongBetween (1 , 100 );
495495
496- scheduledFutures .add (scheduler .schedule ((Runnable ) () -> strings .add ("deferred" ), delayMillis , TimeUnit .MILLISECONDS ));
496+ scheduledFutures .add (scheduler .schedule (() -> strings .addLast ("deferred" ), delayMillis , TimeUnit .MILLISECONDS ));
497497 assertFalse (taskQueue .hasRunnableTasks ());
498498 assertTrue (taskQueue .hasDeferredTasks ());
499499
500- scheduledFutures .add (scheduler .schedule ((Runnable ) () -> strings .add ("runnable" ), 0 , TimeUnit .MILLISECONDS ));
500+ scheduledFutures .add (scheduler .schedule (() -> strings .addLast ("runnable" ), 0 , TimeUnit .MILLISECONDS ));
501501 assertTrue (taskQueue .hasRunnableTasks ());
502502
503- scheduledFutures .add (scheduler .schedule ((Runnable ) () -> strings .add ("also runnable" ), -1 , TimeUnit .MILLISECONDS ));
503+ scheduledFutures .add (scheduler .schedule (() -> strings .addLast ("also runnable" ), -1 , TimeUnit .MILLISECONDS ));
504504
505505 taskQueue .runAllTasks ();
506506
@@ -511,8 +511,8 @@ public void testThreadPoolScheduler() {
511511 final long delayMillis1 = randomLongBetween (2 , 100 );
512512 final long delayMillis2 = randomLongBetween (1 , delayMillis1 - 1 );
513513
514- scheduler .schedule ((Runnable ) () -> strings .add ("further deferred" ), delayMillis1 , TimeUnit .MILLISECONDS );
515- scheduler .schedule ((Runnable ) () -> strings .add ("not quite so deferred" ), delayMillis2 , TimeUnit .MILLISECONDS );
514+ scheduler .schedule (() -> strings .addLast ("further deferred" ), delayMillis1 , TimeUnit .MILLISECONDS );
515+ scheduler .schedule (() -> strings .addLast ("not quite so deferred" ), delayMillis2 , TimeUnit .MILLISECONDS );
516516
517517 assertFalse (taskQueue .hasRunnableTasks ());
518518 assertTrue (taskQueue .hasDeferredTasks ());
@@ -522,7 +522,7 @@ public void testThreadPoolScheduler() {
522522
523523 final long cancelledDelayMillis = randomLongBetween (1 , 100 );
524524 final var cancelledBeforeExecution = scheduler .schedule (
525- (Runnable ) () -> strings .add ("cancelled before execution" ),
525+ () -> strings .addLast ("cancelled before execution" ),
526526 cancelledDelayMillis ,
527527 TimeUnit .MILLISECONDS
528528 );
0 commit comments