@SuppressWarnings("unchecked")
  public static <T extends Exprent> void findExprents(Statement start, Class<? extends T> exprClass, Predicate<T> predicate, boolean onlyOneStat, BiConsumer<Statement, T> consumer) {
    Queue<Statement> statQueue = new ArrayDeque<>();
    statQueue.offer(start);

    while (!statQueue.isEmpty()) {
      Statement stat = statQueue.remove();
      statQueue.addAll(stat.getStats());

      if (stat.getExprents() != null) {
        boolean foundAny = false;

        for (Exprent expr : stat.getExprents()) {
          if (exprClass.isInstance(expr) && predicate.test((T) expr)) {
            consumer.accept(stat, (T) expr);
            foundAny = true;
          }
        }

        if (onlyOneStat && foundAny) {
          break;
        }
      }
    }
  }
Recursively searches one statement for matching exprents.

@param start       the statement to search
@param exprClass   the wanted exprent type
@param predicate   a predicate for filtering the exprents
@param onlyOneStat if true, will return eagerly after the first matching statement
@param consumer    the consumer that receives the exprents and their parent statements
src/org/jetbrains/java/decompiler/modules/decompiler/SwitchHelper.java