code: public static boolean contains(Iterator<?> iterator, Object element) {
          if (iterator != null) {
              while (iterator.hasNext()) {
                  Object candidate = iterator.next();
                  if (ObjectUtils.nullSafeEquals(candidate, element)) {
                      return true;
                  }
              }
          }
          return false;
      }
docs: Check whether the given Iterator contains the given element.
  
  @param iterator the Iterator to check.
  @param element the element to look for.
  
  @return {@code true} if found, {@code false} else.