IndexList
open class IndexList : ListBase, Sequence
A list of item type EntitySet$Index
.
-
An immutable empty
EntitySet$IndexList
.Declaration
Swift
public static let empty: EntitySet.IndexList
-
Construct a new list with
length
of 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
capacity
Optional initial capacity.
-
Add all the items of
list
to the end of this list.Declaration
Swift
public final func append(contentsOf list: EntitySet.IndexList)
Parameters
list
Items to be added.
-
Declaration
Swift
public final func copy() -> EntitySet.IndexList
Return Value
A shallow copy of this list.
-
Declaration
Parameters
predicate
Function 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
item
Item for comparison. Comparison uses the
equality
property, which would usually be expected to match the==
operator for item typeEntitySet$Index
.start
Zero-based starting index (search moves forwards from this index).
Return Value
First index in this list of
item
, or-1
if not found. -
Insert all items of
list
into this list, before the item (if any) atindex
.Throws
ListIndexException
ifindex
is out of range (0 tolength
).Declaration
Swift
public final func insert(at index: Int, contentsOf list: EntitySet.IndexList)
Parameters
index
Zero-based index.
list
List of items to be inserted.
-
Declaration
Parameters
item
Item for comparison. Comparison uses the
equality
property, which would usually be expected to match the==
operator for item typeEntitySet$Index
.start
Zero-based starting index (search moves backwards from this index).
Return Value
Last index in this list of
item
, or-1
if not found. -
See also
copy
,reverse
.Declaration
Swift
open func reversed() -> EntitySet.IndexList
Return Value
a reversed copy of this list.
-
Return a new
EntitySet$IndexList
that shares theListBase.untypedList
as thelist
parameter. To ensure type safety, items inlist
that do not have the item typeEntitySet$Index
will be removed.Parameters
list
List whose items will be shared by the resulting list.
Return Value
A new list of item type
EntitySet$Index
, sharing the same items aslist
. -
Declaration
Swift
public final func slice(start: Int, end: Int = (2147483647 as Int)) -> EntitySet.IndexList
Parameters
start
Zero-based starting index (inclusive), or negative for starting index relative to the end of this list.
end
Zero-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
increasing
Predicate that returns
true
if its first argument should preceed its second argument in the desired ordering. -
See also
copy
,sort
.Declaration
Swift
public final func sorted() -> EntitySet.IndexList
Return Value
a sorted copy of this list using this list’s default
comparer
for ordering (stable sort, O(n log n) complexity). -
See also
copy
,sortBy
.Declaration
Parameters
increasing
Predicate that returns
true
if 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).