Class DataList.Mut
- Enclosing class:
DataList
Note that although the list itself is mutable, DataTrees and DataLists contained within its
element entries may or may not be. Thus, the type itself does not guarantee that its values are mutable.
-
Nested Class Summary
Nested classes/interfaces inherited from class space.arim.dazzleconf.backend.DataList
DataList.Immut, DataList.Mut -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given entry, expanding this list to accommodatevoidclear()Clears all datavoidRuns an action for each element.@NonNull DataEntryget(int idx) Gets the entry at the specified index.@NonNull DataList.ImmutGets this data tree as an immutable one.@NonNull DataList.MutintoMut()Gets this data list as a mutable one.booleanisEmpty()Whether this data list is devoid of elementsvoidReplaces the element at the given indexintsize()The number of elements in this data tree indicates its size
-
Constructor Details
-
Mut
public Mut()Creates -
Mut
public Mut(int initialCapacity) Creates with a capacity hint- Parameters:
initialCapacity- how many elements are expected to be held
-
Mut
Creates from the given elements.The array is copied to ensure immutability, and each entry is checked that it is not null.
- Parameters:
entries- the elements, none of which can be null
-
Mut
Creates from the given elements.The collection is copied to ensure immutability, and each entry is checked that it is not null. The encounter order of the collection becomes the order of this list.
- Parameters:
entries- the elements, none of which can be null
-
-
Method Details
-
isEmpty
public boolean isEmpty()Description copied from class:DataListWhether this data list is devoid of elements -
size
public int size()Description copied from class:DataListThe number of elements in this data tree indicates its size -
intoImmut
Description copied from class:DataListGets this data tree as an immutable one.The data contained within this
DataTreeis moved to an immutable instance. The old instance may still be used, but the implementation of this method may be optimized for the case that it is not.If this instance is already
DataList.Immut, then it may be returned without changes. -
intoMut
Description copied from class:DataListGets this data list as a mutable one.If not mutable, the data is copied to a new list, which will be made deeply mutable. That is, this function will also be called on any
DataLists encountered in this list's entries, andDataTree.intoMut()on any data trees likewise.If this instance is already
DataList.Immut, then it may be returned without changes. -
get
Description copied from class:DataListGets the entry at the specified index. -
forEach
Description copied from class:DataListRuns an action for each element. -
add
Adds the given entry, expanding this list to accommodate- Parameters:
entry- the entry
-
set
Replaces the element at the given index- Parameters:
idx- the indexentry- the entry to place there- Throws:
IndexOutOfBoundsException- if the index is out of bounds
-
clear
public void clear()Clears all data
-