Keep the array Object to allow reuse

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-12-09 18:04:40 +01:00
parent ac4210d7d7
commit f9b1ec8798

View File

@ -295,7 +295,7 @@ public final class ViewEngine {
synchronized (mutex) {
final int size = size();
if (size == 0) return EMPTY;
Player[] array = new Player[size];
Object[] array = new Object[size];
AtomicInteger index = new AtomicInteger();
forEach(player -> array[index.getAndIncrement()] = player);
assert index.get() == size;