code: public static <T> PeekingCloseableIterator<T> peekingIterator(final CloseableIterator<T> iterator) {
          final PeekingIterator<T> peeking = Iterators.peekingIterator(iterator);
          return new PeekingCloseableIterator<T>() {
              @Override
              public void close() {
                  iterator.close();
              }
  
              @Override
              public T peek() {
                  return peeking.peek();
              }
  
              @Override
              public T next() {
                  return peeking.next();
              }
  
              @Override
              public void remove() {
                  peeking.remove();
              }
  
              @Override
              public boolean hasNext() {
                  return peeking.hasNext();
              }
          };
      }
docs: Returns a {@code PeekingCloseableIterator} backed by the given closeable iterator.
  <p/>
  Calls to peek do not change the state of the iterator.  The subsequent call to next
  after peeking will always return the same value.