EntityValueList
open class EntityValueList : ListBase, Codable, EntityValueOrList, Sequence
A list of item type EntityValue
.
-
Decode and initialize a new object instance
Declaration
Swift
public required init(from decoder: Decoder) throws
Parameters
from
decoder object which contains the original object’s serialized data in a container instance
-
Encode the object instance
Declaration
Swift
public func encode(to encoder: Encoder) throws
Parameters
to
encoder object which can be used to serialize the object’s data one by one into a container instance
-
Undocumented
Declaration
Swift
public subscript(index: Int) -> EntityValue { get set }
-
An immutable empty
EntityValueList
.Declaration
Swift
public static let empty: EntityValueList
-
Comparer for sorting a list of entities by key property (or composite key properties).
Declaration
Swift
public static let compareKeys: Comparer
-
true
if this list is a delta response.Declaration
Swift
final public var isDelta: Bool
-
true
if this list is a referece. Iftrue
, thereadLink
will be non-null, and this list will be empty.Declaration
Swift
final public var isReference: Bool
-
An optional link that can be followed (by the caller) to get subsequent changes to this list.
Declaration
Swift
final public var deltaLink: String?
-
An optional link that can be followed (by the caller) to fetch additional list items. If this entity list was produced via server-driven paging, then the server may have provided a next-link which can be followed to obtain more items.
Declaration
Swift
final public var nextLink: String?
-
An optional link that can be followed (by the caller) to re-read this list.
Declaration
Swift
final public var readLink: String?
-
Total number of items available in the server-side list, which may be greater than
length
if the client requested an inlineDataQuery.count
.Declaration
Swift
final public var totalCount: Int64?
-
A list of changed links associated with this entity list.
Declaration
Swift
final public var changedLinks: ChangedLinkList
-
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
item
to the end of this list.Declaration
Swift
public final func append(_ item: EntityValue)
Parameters
item
Item to be added.
-
Add all the items of
list
to the end of this list.Declaration
Swift
public final func append(contentsOf list: EntityValueList)
Parameters
list
Items to be added.
-
Add
item
to the end of this list. It is unusual for aEntityValueList
to containnil
items, soadd
is usually used.Declaration
Swift
open func appendOptional(_ item: EntityValue?) -> EntityValueList
Parameters
item
Item to be added, which might be
nil
.Return Value
This list.
-
Declaration
Swift
open func applyPageSize(query: DataQuery) -> EntityValueList
Parameters
query
Data query whose
DataQuery.pageSize
is used for filtering.Return Value
A new list with at most
query.pageSize
initial items of this list. The result’sEntityValueList.needsNextLink
will betrue
if the original list length exceeded the page size. -
Declaration
Swift
public final func copy() -> EntityValueList
Return Value
A shallow copy of this list.
-
The data type for this list.
Declaration
Swift
override open var dataType: DataType { get }
-
See also
EntityValue.equal
.Declaration
Swift
open class func equal(a: EntityValueList?, b: EntityValueList?) -> Bool
Parameters
a
First entity list.
b
Second entity list.
Return Value
true
if two entity lists have equal items. -
Declaration
Swift
public final func filter(_ predicate: @escaping (EntityValue) -> Bool) -> EntityValueList
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.
-
Declaration
Swift
open func filterAndSort(query: DataQuery) throws -> EntityValueList
Parameters
query
Data query.
Return Value
A new list filtered by
filterWithQuery
and then sorted bysortWithQuery
. -
Declaration
Swift
open func filterWithQuery(_ query: DataQuery) throws -> EntityValueList
Parameters
query
Data query used for filtering.
Return Value
A new list with the items of this list, filtered by
query.queryFilter
,query.derivedType
,query.entityKey
,query.deltaTime
,query.searchExpression
(whichever of those is specified, if any). -
Throws
EmptyListException
if the list is empty.Declaration
Swift
public final func first() -> EntityValue
Return Value
The first item in this list.
-
Convert array to list.
Declaration
Swift
open class func fromArray(_ array: Array<EntityValue>) -> EntityValueList
Parameters
array
Array with source items.
Return Value
New list with items copied from
array
parameter. -
Deprecated (renamed to
fromOptional
). Convert array to list.Declaration
Swift
open class func fromNullable(_ array: Array<EntityValue?>) -> EntityValueList
Parameters
array
Array with optional source items.
Return Value
New list with items copied from
array
parameter. -
Convert array to list.
Declaration
Swift
open class func fromOptional(_ array: Array<EntityValue?>) -> EntityValueList
Parameters
array
Array with optional source items.
Return Value
New list with items copied from
array
parameter. -
Declaration
Swift
public final func includes(item: EntityValue) -> Bool
Parameters
item
Item for comparison. Comparison uses the
equality
property, which would usually be expected to match the==
operator for item typeEntityValue
.Return Value
true
if this list containsitem
. -
Declaration
Swift
public final func indexOf(item: EntityValue, start: Int = (0 as Int)) -> Int
Parameters
item
Item for comparison. Comparison uses the
equality
property, which would usually be expected to match the==
operator for item typeEntityValue
.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
item
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, item: EntityValue)
Parameters
index
Zero-based index.
item
Item to be added.
-
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: EntityValueList)
Parameters
index
Zero-based index.
list
List of items to be inserted.
-
Throws
ListIndexException
ifindex
is out of range (0 tolength
- 1).Declaration
Swift
public final func item(at index: Int) -> EntityValue
Parameters
index
Zero-based index.
Return Value
The item in this list at the specified
index
. -
Throws
EmptyListException
if the list is empty.Declaration
Swift
public final func last() -> EntityValue
Return Value
The last item in this list.
-
Declaration
Swift
public final func lastIndexOf(item: EntityValue, start: Int = (2147483647 as Int)) -> Int
Parameters
item
Item for comparison. Comparison uses the
equality
property, which would usually be expected to match the==
operator for item typeEntityValue
.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. -
Declaration
Swift
open func makeIterator() -> IndexingIterator<Array<EntityValue>>
Return Value
This list converted to a Swift iterator.
-
Declaration
Swift
open class func of(_ items: EntityValue...) -> EntityValueList
Parameters
rest_items
Items for the resulting list.
Return Value
A new list of item type
EntityValue
, containing the specifieditems
. -
Throws
ListIndexException
ifindex
is out of range (0 tolength
- 1).Declaration
Swift
open func optionalItem(at index: Int) -> EntityValue?
Parameters
index
Zero-based index.
Return Value
The item in this list at the specified
index
, which might benil
. It is unusual for aEntityValueList
to containnil
items, soget
is usually used (althoughget
will throw a fatal exception for anil
item). -
See also
copy
,reverse
.Declaration
Swift
open func reversed() -> EntityValueList
Return Value
a reversed copy of this list.
-
Return a new
EntityValueList
that shares theListBase.untypedList
as thelist
parameter. To ensure type safety, items inlist
that do not have the item typeEntityValue
will be removed.Declaration
Swift
open class func share(_ list: ListBase) -> EntityValueList
Parameters
list
List whose items will be shared by the resulting list.
Return Value
A new list of item type
EntityValue
, sharing the same items aslist
. -
Return a new
EntityValueList
that shares theListBase.untypedList
of thelist
parameter, including nulls. To ensure type safety, non-null items inlist
that do not have the item type will be removed.Declaration
Swift
open class func shareOptional(_ list: ListBase) -> EntityValueList
Parameters
list
List whose items will be shared by the resulting list.
Return Value
A new list of item type
EntityValue
?, sharing the same items aslist
. -
Throws
EmptyListException
if the list has no items,NotUniqueException
if the list has multiple items.Declaration
Swift
public final func single() -> EntityValue
Return Value
A single item from this list.
-
Declaration
Swift
open func skipAndTop(query: DataQuery) -> EntityValueList
Parameters
query
Data query whose
DataQuery.skipCount
andDataQuery.topCount
are used for filtering.Return Value
A new list with at most
query.topCount
items of this list, starting at indexquery.skipCount
. -
Declaration
Swift
public final func slice(start: Int, end: Int = (2147483647 as Int)) -> EntityValueList
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
Swift
public final func sort(by increasing: @escaping (EntityValue, EntityValue) -> Bool)
Parameters
increasing
Predicate that returns
true
if its first argument should preceed its second argument in the desired ordering. -
Sort this list in-place, using
query.sortItems
.Declaration
Swift
open func sortWithQuery(_ query: DataQuery) throws
Parameters
query
Data query whose whose
DataQuery.sortItems
are used for filtering. -
See also
copy
,sort
.Declaration
Swift
public final func sorted() -> EntityValueList
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
Swift
public final func sorted(by increasing: @escaping (EntityValue, EntityValue) -> Bool) -> EntityValueList
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).
-
Declaration
Swift
open func toArray() -> Array<EntityValue>
Return Value
This list converted to a Swift array.
-
Set the item in this list at the specified
index
.Declaration
Swift
public final func update(at index: Int, item: EntityValue)
Parameters
index
Zero-based index.
item
Item value.
-
Set the item in this list at the specified
index
. It is unusual for aEntityValueList
to containnil
items, soset
is usually used.Throws
ListIndexException
ifindex
is out of range (0 tolength
- 1).Declaration
Swift
open func updateOptional(at index: Int, item: EntityValue?)
Parameters
index
Zero-based index.
item
Item value, which might be
nil
. -
Override the type of this list, and return this list.
Declaration
Swift
open func withItemType(_ type: DataType) -> EntityValueList
Parameters
type
Data type for the items in this list.
Return Value
This list.
-
See also
addNullable
,getNullable
,setNullable
.Declaration
Swift
open func withNulls() -> EntityValueListWithNulls
Return Value
A wrapper of this list which uses a nullable item type. This may be useful for obtaining an iterator of obviously-nullable items.
-
Override the type of this list, and return this list.
Declaration
Swift
open func withType(_ type: DataType) -> EntityValueList
Parameters
type
Data type for a list of entity values. Use
DataType.listOf
to obtain a suitable list type.Return Value
This list.