@SuppressWarnings("unchecked")
	public static <T> void dispatchAndRemoveIf(@Nonnull ObservableValue<T> value, @Nonnull RemovalChangeListener<T> listener) {
		ChangeListener<? super T>[] handle = new ChangeListener[1];
		handle[0] = (observable, oldValue, newValue) -> {
			if (listener.changed(observable, oldValue, newValue)) {
				FxThreadUtil.run(() -> observable.removeListener(handle[0]));
			}
		};
		value.addListener(handle[0]);
	}
Registers an event listener and removes it,
as soon as {@link RemovalChangeListener} returns {@code true}.

@param value
		Value to register listener for.
@param listener
		Listener to register.
@param <T>
		Value type.
recaf-ui/src/main/java/software/coley/recaf/util/NodeEvents.java