void (@NotNull String pattern, Processor<Object> consumer) { for (SearchTopHitProvider provider : SearchTopHitProvider.EP_NAME.getExtensions()) { boolean[] interrupted = {false}; provider.consumeTopHits(pattern, o -> interrupted[0] = !consumer.process(o), myProject); if (interrupted[0]) { return; } } }