Discussion: These rules are designed as a dynamically-typed variation of the Java rules for variable arity methods. In both cases, callers to a variable arity method or method handle can either pass zero or more positional arguments, or else pass pre-collected arrays of any length. Users should be aware of the special role of the final argument, and of the effect of a type match on that final argument, which determines whether or not a single trailing argument is interpreted as a whole array or a single element of an array to be collected. Note that the dynamic type of the trailing argument has no effect on this decision, only a comparison between the symbolic type descriptor of the call site and the type descriptor of the method handle.) @param arrayType often {@code Object[]}, the type of the array argument which will collect the arguments @return a new method handle which can collect any number of trailing argumentsinto an array, before calling the original method handle @throws NullPointerException if {@code arrayType} is a null reference @throws IllegalArgumentException if {@code arrayType} is not an array typeor {@code arrayType} is not assignable to this method handle's trailing parameter type @see #asCollector @see #isVarargsCollector @see #asFixedArity
|
|