reactor-core/src/main/java/reactor/core/publisher/OperatorDisposables.java
public static boolean validate(@Nullable Disposable current, Disposable next,
			Consumer<RuntimeException> errorCallback) {
		//noinspection ConstantConditions
		if (next == null) {
			errorCallback.accept(new NullPointerException("next is null"));
			return false;
		}
		if (current != null) {
			next.dispose();
			errorCallback.accept(new IllegalStateException("Disposable already pushed"));
			return false;
		}
		return true;
	}
public static boolean validate(@Nullable Disposable current, Disposable next,
			Consumer<RuntimeException> errorCallback) {
		//noinspection ConstantConditions
		if (next == null) {
			errorCallback.accept(new NullPointerException("next is null"));
			return false;
		}
		if (current != null) {
			next.dispose();
			errorCallback.accept(new IllegalStateException("Disposable already pushed"));
			return false;
		}
		return true;
	}
public static boolean validate ( @ Nullable Disposable current , Disposable next , Consumer < RuntimeException > errorCallback ) { //noinspection ConstantConditions if ( next == null ) { errorCallback . accept ( new NullPointerException ( "next is null" ) ) ; return false ; } if ( current != null ) { next . dispose ( ) ; errorCallback . accept ( new IllegalStateException ( "Disposable already pushed" ) ) ; return false ; } return true ; }
Verify that current is null and next is not null, otherwise signal a
{@link NullPointerException} to the {@code errorCallback} and return false.

@param current the current {@link Disposable}, expected to be null
@param next the next {@link Disposable}, expected to be non-null
@return true if the validation succeeded
Verify that current is null and next is not null otherwise signal a { @link NullPointerException } to the { @code errorCallback } and return false .