operator > method

bool operator >(
  1. Iterable<T> other
)

Returns true if the inequality this(i) > other(i) holds for each index i.

Implementation

bool operator >(Iterable<T> other) {
  final it = iterator;
  final oit = other.iterator;
  bool itHasElement = it.moveNext();
  bool oitHasElement = oit.moveNext();
  while (itHasElement && oitHasElement) {
    if (it.current.compareTo(oit.current) <= 0) {
      return false;
    }
    itHasElement = it.moveNext();
    oitHasElement = oit.moveNext();
  }
  if (itHasElement == oitHasElement) {
    // Same length
    return true;
  } else {
    throw ErrorOfType<LengthMismatch>(
      message: 'Error using \'>\' with $runtimeType.',
      invalidState: 'Length of $this does not match length of $other.',
      expectedState: 'Two iterables with the same length.',
    );
  }
}