16.6. Array Generator Expressions

The array generator expression yields all components of an array as its results.

Array Generator Expression
[48]ArrayGeneratorExpression::=SelectorExpression '[' ':' ']'  

The type of an array generator expression is the component type of the type of the subexpression. It is a compile-time error if the latter type is not an array type.

The array generator expression is a generator expression. Its sequential evaluation evaluates the subexpression. If the result is null, a NullPointerException is thrown. Otherwise, all components of the resulting array are yielded as variables in ascending order of indices.