biggestOccurrence method
Finds the biggest occurrence in the list.
Returns the biggest element in the list based on the Comparable implementation.
Implementation
double? biggestOccurrence() {
// check if the list is empty before calling reduce
if (isEmpty) {
return null;
}
return reduce((double value, double element) => value.compareTo(element) > 0 ? value : element);
}