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
valueusing binary search, or-1if not found. -
containsAny(
List< D> ids) → bool -
Returns true if any of the provided
idsexist in this collection. -
equalsIDs(
List< D> ? ids) → bool -
Returns true if
idsare equal to this collection's IDs. -
getValuesByIndexes<
V> (Iterable< int> indexes, List<V> values) → List<(D, V)> -
Returns
(ID, value)pairs for the givenindexes. -
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.