code: public static Set<AbstractExpression> collectTerminals(AbstractExpression expr) {
          final Set<AbstractExpression> result = new HashSet<>();
          collectTerminals(expr, result);
          return result;
      }
docs: Collect/dedup all terminal/leaf nodes of an expression tree
  @param expr source expression tree
  @return dedup-ed terminal expressions