android/guava/src/com/google/common/collect/Iterators.java
public static <T> T getLast(Iterator<T> iterator) {
    while (true) {
      T current = iterator.next();
      if (!iterator.hasNext()) {
        return current;
      }
    }
  }
public static <T> T getLast(Iterator<T> iterator) {
    while (true) {
      T current = iterator.next();
      if (!iterator.hasNext()) {
        return current;
      }
    }
  }
Advances {@code iterator} to the end, returning the last element.

@return the last element of {@code iterator}
@throws NoSuchElementException if the iterator is empty