ComputeIDs<D extends Object> class

An ordered, comparable, and hashable set of IDs.

IDs are copied and sorted on construction using compare. Equality and hashing are based on the ordered ID list.

Constructors

ComputeIDs(List<D> ids, {ComputeIDCompare<D>? compare, ComputeIDHash<D>? hash})
Creates a sorted and deduplicated ID collection.

Properties

compare ComputeIDCompare<D>?
Comparator used to order and compare IDs.
final
hash ComputeIDHash<D>?
Optional hash function used for hashCode computation.
final
hashCode int
The hash code for this object.
no setteroverride
ids List<D>
Unmodifiable view of the ordered IDs.
no setter
length int
Number of IDs.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

binarySearchIndex(D value) int
Returns the index of value using binary search, or -1 if not found.
containsAny(List<D> ids) bool
Returns true if any of the provided ids exist in this collection.
equalsIDs(List<D>? ids) bool
Returns true if ids are equal to this collection's IDs.
getValuesByIndexes<V>(Iterable<int> indexes, List<V> values) List<(D, V)>
Returns (ID, value) pairs for the given indexes.
intersection(List<D> ids) List<(int, D)>
Returns the intersection between this collection and ids.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override
operator [](int index) → D
Returns the ID at index.