getValue method

List<int> getValue()

Determines the maximum occurrence of a set value and returns all values which were set with this occurrence. @return an array of int, containing the values with the highest occurrence, or null, if no value was set

Implementation

List<int> getValue() {
  int maxConfidence = -1;
  final result = <int>[];
  for (MapEntry<int, int> entry in _values.entries) {
    if (entry.value > maxConfidence) {
      maxConfidence = entry.value;
      result.clear();
      result.add(entry.key);
    } else if (entry.value == maxConfidence) {
      result.add(entry.key);
    }
  }
  return result;
}