ListBase
open class ListBase : DataValue, @unchecked Sendable
Base class for strongly-typed lists.
-
The number of items in this list.
Declaration
Swift
public final var count: Int { get } -
Construct a new list with a
lengthof zero and specified initialcapacity. A list can expand in length beyond its initial capacity, but best performance will be obtained if the initial capacity is close to (and not less than) the list’s maximum length.Declaration
Swift
public init(capacity: Int)Parameters
capacityInitial capacity.
-
An ordering function for the item type of this list.
Declaration
Swift
open var comparer: Comparer { get } -
The data type for this list.
Declaration
Swift
override open var dataType: DataType { get } -
An equality function for the item type of this list.
Declaration
Swift
open var equality: Equality { get } -
trueif this list is empty.Declaration
Swift
@inline(__always) public final var isEmpty: Bool { get } -
trueif this list is mutable.Declaration
Swift
@inline(__always) public final var isMutable: Bool { get } -
trueif this list is not empty.Declaration
Swift
@inline(__always) public final var isNotEmpty: Bool { get } -
The number of items in this list.
Declaration
Swift
@inline(__always) public final var length: Int { get } -
Mark this list as immutable. Subsequent attempts to mutate the list will throw an
ImmutableException.Declaration
Swift
public final func makeImmutable() -
Remove an item from the specified index in this list.
Declaration
Swift
public final func remove(at index: Int)Parameters
indexIndex of the item to be removed.
-
Remove all items from this list.
Declaration
Swift
public final func removeAll() -
Remove the first item (if any) from this list.
Declaration
Swift
public final func removeFirst() -
Remove the last item (if any) from this list.
Declaration
Swift
public final func removeLast() -
Remove a range of items from this list.
Declaration
Swift
public final func removeRange(start: Int, end: Int)Parameters
startStarting index (inclusive) for items to be removed.
endEnding index (exclusive) for items to be removed.
-
Reverse the order of the items in this list.
Declaration
Swift
public final func reverse() -
Sort this list in place, using this list’s default
comparerfor ordering (stable sort, O(n log n) complexity).Declaration
Swift
public final func sort() -
Sort this list in place (stable sort, O(n log n) complexity).
Declaration
Swift
public final func sortWith(comparer: Comparer)Parameters
comparerComparer for ordering.
-
Swap the items at indexes
firstandsecond.Declaration
Swift
public final func swap(_ first: Int, _ second: Int)Parameters
firstIndex of first item to swap.
secondIndex of second item to swap.
-
Declaration
Swift
open func toDynamic() -> ListBase?Return Value
a dynamic representation of this list (
DataValueList,ComplexValueList, orEntityValueList), ornilif there is no dynamic representation available. -
Declaration
Swift
override open func toString() -> StringReturn Value
a string representation of this list.
-
The underlying untyped list. Use with care, avoiding the addition of objects with an incorrect item type.
Declaration
Swift
@inline(__always) public final var untypedList: UntypedList { get }