code: public static long count(Iterator<String> iterator) {
          if (iterator == null) {
              return 0;
          }
          long count = 0;
          while (iterator.hasNext()) {
              ++count;
              iterator.next();
          }
          return count;
      }
docs: Determines the number of elements in an iteration.
  
  @param iterator
  @return