private static <T extends Event> void removeHandler(@Nonnull Node node, @Nonnull EventHandler<T> handler,
	                                                    @Nonnull Function<Node, EventHandler<T>> handlerGetter,
	                                                    @Nonnull BiConsumer<Node, EventHandler<T>> handlerSetter) {
		EventHandler<T> currentHandler = Unchecked.cast(handlerGetter.apply(node));
		if (currentHandler instanceof SplittingHandler<T> splittingHandler) {
			if (splittingHandler.primary == handler)
				handlerSetter.accept(node, splittingHandler.secondary);
			else
				splittingHandler.remove(handler);
		} else if (currentHandler == handler)
			handlerSetter.accept(node, null);
	}
@param node
		Node to remove from.
@param handler
		Handler to remove.
recaf-ui/src/main/java/software/coley/recaf/util/NodeEvents.java