AggregationArguments { public <T extends Expression> List<T> all(final Class<T> expected) { final List<T> result = ImmutableList.copyOf(args.stream().map(v -> v.cast(expected)).iterator()); args.clear(); return result; } AggregationArguments(
        final List<? extends Expression> args, final Map<String, ? extends Expression> kw
    ); List<T> all(final Class<T> expected); Optional<T> positionalOrKeyword(
        final String key, Class<T> expected
    ); Optional<T> positional(Class<T> expected); Optional<T> keyword(final String key, Class<T> expected); void throwUnlessEmpty(final String name);  }
@Test public void all() { final AggregationArguments arguments = new AggregationArguments(ImmutableList.of(a, b), ImmutableMap.of()); final List<Expression> result = arguments.all(Expression.class); assertEquals(ImmutableList.of(a, b), result); verify(a).cast(Expression.class); verify(b).cast(Expression.class); }