require2DArray
The check to put in front of Range#setValues, which rejects a flat array with a message that names neither the argument nor the reason. require2DArray throws first, with a message you control, and returns the value so the call composes into an expression.
It accepts exactly what is2DArray accepts: a non-empty array whose every element is an array. Rows of differing length pass — use requireConsistent2DArray when they must match.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The value to validate. |
|
| The exception message. Defaults to |
Returns
T[][] — the same value, typed as a two-dimensional array.
Throws
Exception | Condition |
|---|---|
| The value is not a non-empty array of arrays. |
Examples
Validating and using in one expression
What passes and what throws
See also
is2DArray— the same test as a predicate.non2DArray— the negated predicate.requireConsistent2DArray— also requires uniform row lengths.
Source
This documentation was generated with AI (Claude) from the library's source code.