@CanIgnoreReturnValue
  public static boolean retainAll(Iterator<?> removeFrom, Collection<?> elementsToRetain) {
    """
	Traverses an iterator and removes every element that does not belong to the provided
	collection. The iterator will be left exhausted: its {@code hasNext()} method will return
	{@code false}.
	
	@param removeFrom the iterator to (potentially) remove elements from
	@param elementsToRetain the elements to retain
	@return {@code true} if any element was removed from {@code iterator}
    """
    checkNotNull(elementsToRetain);
    boolean result = false;
    while (removeFrom.hasNext()) {
      if (!elementsToRetain.contains(removeFrom.next())) {
        removeFrom.remove();
        result = true;
      }
    }
    return result;
  }
@CanIgnoreReturnValue
  public static boolean retainAll(Iterator<?> removeFrom, Collection<?> elementsToRetain) {
    checkNotNull(elementsToRetain);
    boolean result = false;
    while (removeFrom.hasNext()) {
      if (!elementsToRetain.contains(removeFrom.next())) {
        removeFrom.remove();
        result = true;
      }
    }
    return result;
  }
@ CanIgnoreReturnValue public static boolean retainAll ( Iterator < ? > removeFrom , Collection < ? > elementsToRetain ) { checkNotNull ( elementsToRetain ) ; boolean result = false ; while ( removeFrom . hasNext ( ) ) { if ( ! elementsToRetain . contains ( removeFrom . next ( ) ) ) { removeFrom . remove ( ) ; result = true ; } } return result ; }
Traverses an iterator and removes every element that does not belong to the provided
collection. The iterator will be left exhausted: its {@code hasNext()} method will return
{@code false}.

@param removeFrom the iterator to (potentially) remove elements from
@param elementsToRetain the elements to retain
@return {@code true} if any element was removed from {@code iterator}
Traverses an iterator and removes every element that does not belong to the provided collection . The iterator will be left exhausted : its { @code hasNext () } method will return { @code false } .