public static boolean contains(@Nullable Iterator<?> iterator, Object element) {
        if (iterator != null) {
            while (iterator.hasNext()) {
                Object candidate = iterator.next();
                if (ObjectUtils.nullSafeEquals(candidate, element)) {
                    return true;
                }
            }
        }
        return false;
    }
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} otherwise
analyzer/src/main/java/nl/basjes/parse/useragent/utils/springframework/util/CollectionUtils.java