isEquivalentTo method

  1. @override
bool isEquivalentTo(
  1. HandInterface other
)
override

Implementation

@override
bool isEquivalentTo(HandInterface other) {
  if (other is! OrphanHand) return false;
  if (_cards.length != other.length) return false;

  // Have to do the hard way if duplicates are possible.
  List<Card> as = _cards.toList();
  List<Card> os = other.toList();
  ojSort(as);
  ojSort(os);
  for (int i = 0; i < as.length; i += 1) {
    if (as[i] != os[i]) return false;
  }
  return true;
}