mirror of https://github.com/Minestom/Minestom.git
Unnecessary array util
This commit is contained in:
parent
96fee8541d
commit
3e184abc0f
|
@ -223,7 +223,7 @@ public final class CommandManager {
|
|||
request.retrieve(argumentNode);
|
||||
}
|
||||
// Add root node children
|
||||
rootNode.children = ArrayUtils.toArray(rootChildren);
|
||||
rootNode.children = rootChildren.toIntArray();
|
||||
return new DeclareCommandsPacket(nodes, 0);
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ public final class CommandManager {
|
|||
|
||||
// Append to the last node
|
||||
{
|
||||
final int[] children = ArrayUtils.toArray(argChildren);
|
||||
final int[] children = argChildren.toIntArray();
|
||||
for (DeclareCommandsPacket.Node lastNode : lastNodes) {
|
||||
lastNode.children = lastNode.children == null ?
|
||||
children :
|
||||
|
@ -422,7 +422,7 @@ public final class CommandManager {
|
|||
argumentIdentityMap.put(indexedArgument.argument, value);
|
||||
});
|
||||
|
||||
literalNode.children = ArrayUtils.toArray(cmdChildren);
|
||||
literalNode.children = cmdChildren.toIntArray();
|
||||
return literalNode;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.minestom.server.utils;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -27,10 +26,6 @@ public final class ArrayUtils {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static void removeElement(@NotNull Object[] arr, int index) {
|
||||
System.arraycopy(arr, index + 1, arr, index, arr.length - 1 - index);
|
||||
}
|
||||
|
||||
public static <K, V> Map<K, V> toMap(@NotNull K[] keys, @NotNull V[] values, int length) {
|
||||
assert keys.length >= length && keys.length == values.length;
|
||||
return switch (length) {
|
||||
|
@ -59,12 +54,6 @@ public final class ArrayUtils {
|
|||
};
|
||||
}
|
||||
|
||||
public static int @NotNull [] toArray(@NotNull IntList list) {
|
||||
int[] array = new int[list.size()];
|
||||
list.getElements(0, array, 0, array.length);
|
||||
return array;
|
||||
}
|
||||
|
||||
private static final int INDEX_NOT_FOUND = -1;
|
||||
|
||||
public static int indexOf(final Object[] array, final Object objectToFind) {
|
||||
|
|
Loading…
Reference in New Issue