void (@NotNull ProgressIndicator progress, @NotNull Consumer<? super Double> consumer) { ProgressIndicatorListener listener = new ProgressIndicatorListener() { @Override public void onFractionChanged(double fraction) { consumer.accept(fraction); } }; listener.installToProgressIfPossible(progress); }