EntryList
open class EntryList : ListBase, Sequence, @unchecked Sendable
A list of item type StringMap$Entry.
-
An immutable empty
StringMap$EntryList.Declaration
Swift
public static let empty: StringMap.EntryList -
Construct a new list with
lengthof zero and optional 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
override public init(capacity: Int = (4 as Int))Parameters
capacityOptional initial capacity.
-
Add all the items of
listto the end of this list.Declaration
Swift
public final func append(contentsOf list: StringMap.EntryList)Parameters
listItems to be added.
-
Declaration
Swift
public final func copy() -> StringMap.EntryListReturn Value
A shallow copy of this list.
-
Declaration
Parameters
predicateFunction to be applied to each item of this list. Items matching this predicate will be returned in the new list.
Return Value
A new list which contains the items of this list that match a specified predicate function. Ordering is preserved.
-
Parameters
itemItem for comparison. Comparison uses the
equalityproperty, which would usually be expected to match the==operator for item typeStringMap$Entry.startZero-based starting index (search moves forwards from this index).
Return Value
First index in this list of
item, or-1if not found. -
Insert all items of
listinto this list, before the item (if any) atindex.Throws
ListIndexExceptionifindexis out of range (0 tolength).Declaration
Swift
public final func insert(at index: Int, contentsOf list: StringMap.EntryList)Parameters
indexZero-based index.
listList of items to be inserted.
-
Declaration
Parameters
itemItem for comparison. Comparison uses the
equalityproperty, which would usually be expected to match the==operator for item typeStringMap$Entry.startZero-based starting index (search moves backwards from this index).
Return Value
Last index in this list of
item, or-1if not found. -
See also
copy,reverse.Declaration
Swift
open func reversed() -> StringMap.EntryListReturn Value
a reversed copy of this list.
-
Return a new
StringMap$EntryListthat shares theListBase.untypedListas thelistparameter. To ensure type safety, items inlistthat do not have the item typeStringMap$Entrywill be removed.Parameters
listList whose items will be shared by the resulting list.
Return Value
A new list of item type
StringMap$Entry, sharing the same items aslist. -
Declaration
Swift
public final func slice(start: Int, end: Int = (2147483647 as Int)) -> StringMap.EntryListParameters
startZero-based starting index (inclusive), or negative for starting index relative to the end of this list.
endZero-based ending index (exclusive), or negative for ending index relative to the end of this list.
Return Value
A slice of this list from index
start(inclusive) to indexend(exclusive). -
Sort this list in place (stable sort, O(n log n) complexity).
See also
copy,sort.Declaration
Parameters
increasingPredicate that returns
trueif its first argument should preceed its second argument in the desired ordering. -
See also
copy,sort.Declaration
Swift
public final func sorted() -> StringMap.EntryListReturn Value
a sorted copy of this list using this list’s default
comparerfor ordering (stable sort, O(n log n) complexity). -
See also
copy,sortBy.Declaration
Parameters
increasingPredicate that returns
trueif its first argument should preceed its second argument in the desired ordering.Return Value
a sorted copy of this list (stable sort, O(n log n) complexity).