-
- All Implemented Interfaces:
-
java.util.RandomAccess
,kotlin.collections.Collection
,kotlin.collections.Iterable
,kotlin.collections.List
,kotlin.collections.MutableCollection
,kotlin.collections.MutableIterable
,kotlin.collections.MutableList
public final class NbtList<T extends NbtTag> extends NbtTag implements List<T>, RandomAccess
A tag which contains a MutableList structure of NbtTags. All children must have the same class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
NbtList.Companion
Contains useful methods to create NbtLists from Java.
Kotlin's users may call
list(1,2,3).toNbtList()
or similar methods.
-
Field Summary
Fields Modifier and Type Field Description private final String
stringValue
private final Integer
size
-
Constructor Summary
Constructors Constructor Description NbtList(Collection<T> tags)
Constructs a NbtList with the same contents of the given Collection. NbtList()
Creates an empty list. NbtList(T tags)
Uses all tags as initial value of this list. NbtList(Iterable<T> tags)
Uses all tags as initial value of this list. NbtList(Sequence<T> tags)
Uses all tags as initial value of this list. NbtList(NbtList<T> tags)
Uses all tags as initial value of this list. NbtList(String value)
Parses the string using the same structure which is returned by stringValue.
-
Method Summary
Modifier and Type Method Description String
getStringValue()
Returns a string representation of the tag's value. Integer
getSize()
Boolean
add(T element)
Unit
add(Integer index, T element)
T
set(Integer index, T element)
List<T>
subList(Integer fromIndex, Integer toIndex)
NbtList<T>
deepCopy()
Returns a new NbtList with all nested values copied deeply. Boolean
equals(Object other)
Integer
hashCode()
-
Methods inherited from class br.com.gamemods.nbtmanipulator.NbtList
addAll, addAll, clear, listIterator, listIterator, remove, removeAll, removeAt, replaceAll, retainAll, sort, toString
-
Methods inherited from class kotlin.collections.MutableList
contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, removeIf, spliterator
-
Methods inherited from class kotlin.collections.Collection
forEach
-
Methods inherited from class kotlin.collections.List
parallelStream, stream, toArray
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
NbtList
NbtList(Collection<T> tags)
Constructs a NbtList with the same contents of the given Collection.
-
NbtList
NbtList()
Creates an empty list.
-
NbtList
NbtList(T tags)
Uses all tags as initial value of this list.
-
NbtList
NbtList(String value)
Parses the string using the same structure which is returned by stringValue.- Parameters:
value
- A string with a structure like[NbtInt(0), NbtInt(-32), NbtInt(48), NbtInt(127)]
-
-
Method Detail
-
getStringValue
String getStringValue()
Returns a string representation of the tag's value.
The NbtList and the array types will have an output similar to a normal List and NbtCompound to a normal Map.
The class names of the NbtList's and NbtCompound's children will expose.
The returned string is compatible with string constructors of the same type.
Be aware that this may be a slow operation on big lists, arrays or compounds.
-
-
-
-