Use method reference to create tick threads

This commit is contained in:
themode 2022-02-13 18:11:15 +01:00
parent a25a764991
commit 2608071ee4

View File

@ -33,7 +33,7 @@ public final class ThreadDispatcher<P> {
private ThreadDispatcher(ThreadProvider<P> provider, int threadCount) {
this.provider = provider;
TickThread[] threads = new TickThread[threadCount];
Arrays.setAll(threads, i -> new TickThread(i));
Arrays.setAll(threads, TickThread::new);
this.threads = List.of(threads);
this.threads.forEach(Thread::start);
}