ListBase
open class ListBase : DataValue
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
length
of 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
capacity
Initial 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 }
-
true
if this list is empty.Declaration
Swift
@inline(__always) public final var isEmpty: Bool { get }
-
true
if this list is mutable.Declaration
Swift
@inline(__always) public final var isMutable: Bool { get }
-
true
if 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
index
Index 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
start
Starting index (inclusive) for items to be removed.
end
Ending 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
comparer
for 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
comparer
Comparer for ordering.
-
Declaration
Swift
open func toDynamic() -> ListBase?
Return Value
a dynamic representation of this list (
DataValueList
,ComplexValueList
, orEntityValueList
), ornil
if there is no dynamic representation available. -
Declaration
Swift
override open func toString() -> String
Return 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 }