code: public static boolean elementsEqual(Iterator<?> iterator1, Iterator<?> iterator2) {
      while (iterator1.hasNext()) {
        if (!iterator2.hasNext()) {
          return false;
        }
        Object o1 = iterator1.next();
        Object o2 = iterator2.next();
        if (!Objects.equal(o1, o2)) {
          return false;
        }
      }
      return !iterator2.hasNext();
    }
docs: Determines whether two iterators contain equal elements in the same order. More specifically,
  this method returns {@code true} if {@code iterator1} and {@code iterator2} contain the same
  number of elements and every element of {@code iterator1} is equal to the corresponding element
  of {@code iterator2}.
  
  <p>Note that this will modify the supplied iterators, since they will have been advanced some
  number of elements forward.