Occurrence<T extends Object> class

Represents a value and its frequency count within a collection.

Used by mostOccurrences() and leastOccurrences() extension methods to return both the value and how many times it appears.

Example:

final result = [1, 2, 2, 3].mostOccurrences();
print(result?.value); // 2
print(result?.count); // 2
Annotations

Constructors

Occurrence(T value, int count)
Creates an Occurrence with the given value and count.
const

Properties

count int
How many times value appears in the collection.
final
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T
The value that was found in the collection.
final

Methods

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