@NotNull
  private static <T extends ExternalSystemNode> List<T> doGetNodes(@NotNull Class<T> nodeClass,
                                                                   SimpleNode[] nodes,
                                                                   @NotNull List<T> result,
                                                                   @NotNull Predicate<SimpleNode> shouldDive) {
    if (nodes == null) return result;

    for (SimpleNode node : nodes) {
      if (nodeClass.isInstance(node)) {
        //noinspection unchecked
        result.add((T)node);
      }
      if (shouldDive.test(node)) {
        doGetNodes(nodeClass, node.getChildren(), result, shouldDive);
      }
    }
    return result;
  }
@NotNull
  private static <T extends ExternalSystemNode> List<T> doGetNodes(@NotNull Class<T> nodeClass,
                                                                   SimpleNode[] nodes,
                                                                   @NotNull List<T> result,
                                                                   @NotNull Predicate<SimpleNode> shouldDive)