Package net.minecraft.core
Class NonNullList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
net.minecraft.core.NonNullList<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,SequencedCollection<E>
-
Field Summary
FieldsFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclear()static <E> com.mojang.serialization.Codec<NonNullList<E>> codecOf(com.mojang.serialization.Codec<E> entryCodec) Neo: utility method to construct a Codec for a NonNullListstatic <E> NonNullList<E> copyOf(Collection<? extends E> entries) Neo: utility method to construct an immutable NonNullList from a given collectionstatic <E> NonNullList<E> create()static <E> NonNullList<E> createWithCapacity(int pInitialCapacity) get(int pIndex) static <E> NonNullList<E> of(E pDefaultValue, E... pElements) remove(int pIndex) intsize()static <E> NonNullList<E> withSize(int pSize, E pDefaultValue) Creates a new NonNullList with fixed size and default value.Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addAll, addFirst, addLast, contains, containsAll, getFirst, getLast, isEmpty, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray, toArray
-
Field Details
-
list
-
defaultValue
-
-
Constructor Details
-
NonNullList
-
-
Method Details
-
codecOf
public static <E> com.mojang.serialization.Codec<NonNullList<E>> codecOf(com.mojang.serialization.Codec<E> entryCodec) Neo: utility method to construct a Codec for a NonNullList- Type Parameters:
E- the element type- Parameters:
entryCodec- the codec to use for the elements- Returns:
- a codec that encodes as a list, and decodes into NonNullList
-
copyOf
Neo: utility method to construct an immutable NonNullList from a given collection- Type Parameters:
E- the type of the elements in the list- Parameters:
entries- the collection to make a copy of- Returns:
- a new immutable NonNullList
- Throws:
NullPointerException- if entries is null, or if it contains any nulls
-
create
-
createWithCapacity
-
withSize
Creates a new NonNullList with fixed size and default value. The list will be filled with the default value. -
of
-
get
-
set
-
add
-
remove
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein classAbstractCollection<E>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceList<E>- Overrides:
clearin classAbstractList<E>
-