Result (Expression @NotNull [] params, ExpressionContext context) { if (params.length == 0) return null; Object o = runIt(params, context); if (o instanceof Collection && !((Collection<?>)o).isEmpty()) { return new TextResult(toNormalizedString(((Collection)o).iterator().next())); } if (o instanceof Object[] && ((Object[])o).length > 0) { return new TextResult(toNormalizedString(((Object[])o)[0])); } if (o != null) return new TextResult(toNormalizedString(o)); return null; }