-
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 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
-
The data type for this list.
Declaration
Swift
override open var dataType: DataType
-
An equality function for the item type of this list.
Declaration
Swift
open var equality: Equality
-
true
if this list contains no items.Declaration
Swift
open var isEmpty: Bool
-
The number of items in this list.
Declaration
Swift
open var length: Int
-
Remove an item from the specified index in this list.
Declaration
Swift
open func remove(at index: Int) -> Void
Parameters
index
Index of the item to be removed.
-
Remove all items from this list.
Declaration
Swift
open func removeAll() -> Void
-
Remove the first item (if any) from this list.
Declaration
Swift
open func removeFirst() -> Void
-
Remove the last item (if any) from this list.
Declaration
Swift
open func removeLast() -> Void
-
Remove a range of items from this list.
Declaration
Swift
open func removeRange(start: Int, end: Int) -> Void
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
open func reverse() -> Void
-
Sort the items in this list, using the
comparer
property for ordering.Declaration
Swift
open func sort() -> Void
-
Sort the items in this list.
Declaration
Swift
open func sortWith(comparer: Comparer) -> Void
Parameters
comparer
Comparer for ordering.
-
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
open var untypedList: UntypedList
-
Base function for validating the item’s value before adding it to the list. Validate is needed in some ListBase types, for exampe in the case of ByteList, where a value out of the ByteValue type’s valid range can be added, because ByteList accepts Int instead of Byte. With a proper overwrite of this function in the given BaseList class ensures, that only a valid value Int (-128 - +127 in this case) can be added to the list.
Declaration
Swift
open func validate(_ value: AnyObject?) -> AnyObject?
Parameters
value
The value to be validated.
Return Value
The
value
without modification.