Class DataList.Immut
- Enclosing class:
DataList
This type guarantees that all of its elements are immutable (deep immutability). That is, DataTrees and
DataLists contained within this list's element entries will always be immutable.
-
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 TypeMethodDescriptionvoidRuns 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 elementsintsize()The number of elements in this data tree indicates its size
-
Constructor Details
-
Immut
public Immut()Creates an empty data list -
Immut
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
-
Immut
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.
-