mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-21 06:41:43 +01:00
Use checkIndex
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
35ae8bc07a
commit
2720d9ada2
@ -3,6 +3,7 @@ package net.minestom.server.utils.collection;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.util.AbstractList;
|
||||
import java.util.Objects;
|
||||
import java.util.function.IntFunction;
|
||||
|
||||
@ApiStatus.Internal
|
||||
@ -18,8 +19,7 @@ public final class IntMappedArray<R> extends AbstractList<R> {
|
||||
@Override
|
||||
public R get(int index) {
|
||||
final int[] elements = this.elements;
|
||||
if (index < 0 || index >= elements.length)
|
||||
throw new IndexOutOfBoundsException("Index " + index + " is out of bounds for length " + elements.length);
|
||||
Objects.checkIndex(index, elements.length);
|
||||
return function.apply(elements[index]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user