has method

bool has(
  1. String a,
  2. String b,
  3. bool areMutuallyExclusive
)

Implementation

bool has(String a, String b, bool areMutuallyExclusive) {
  final key1 = a.compareTo(b) < 0 ? a : b;
  final key2 = a.compareTo(b) < 0 ? b : a;

  final result = this._data[key1]?[key2];
  if (result == null) {
    return false;
  }

  // areMutuallyExclusive being false is a superset of being true, hence if
  // we want to know if this PairSet "has" these two with no exclusivity,
  // we have to ensure it was added as such.
  return areMutuallyExclusive || areMutuallyExclusive == result;
}