Package: org.codehaus.groovy.ast.expr

## [Java] Class TupleExpression

- org.codehaus.groovy.ast.expr.TupleExpression

- All Implemented Interfaces and Traits:
    Iterable

      public class TupleExpression
      extends Expression
      implements Iterable

  Represents a tuple or grouped list of expressions, typically used for method arguments, multiple assignment targets, or other contexts requiring multiple values. A tuple expression is a simple container for an ordered list of Expression objects and implements Iterable for convenient traversal.

  See Also:
    Expression for the contained expressions
    MethodCallExpression for usage in method arguments
    ConstructorCallExpression for usage in constructor arguments

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class Expression` | `EMPTY_ARRAY`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `TupleExpression()` Creates an empty tuple expression with zero initial capacity.
    `TupleExpression(Expression expr)` Creates a tuple expression containing a single expression.
    `TupleExpression(Expression expr1, Expression expr2)` Creates a tuple expression containing two expressions.
    `TupleExpression(Expression expr1, Expression expr2, Expression expr3)` Creates a tuple expression containing three expressions.
    `TupleExpression(int capacity)` Creates a tuple expression with pre-allocated capacity.
    `TupleExpression(List<Expression> expressions)` Creates a tuple expression from an existing list of expressions.
    `TupleExpression(Expression[] expressionArray)` Creates a tuple expression from an array of expressions.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public TupleExpression` | `addExpression(Expression expression)` Adds an expression to this tuple.
    `` | `public Expression` | `getExpression(int i)` Returns the expression at the specified index.
    `` | `public List<Expression>` | `getExpressions()` Returns the list of all expressions in this tuple.
    `` | `public String` | `getText()`
    `` | `public Iterator<Expression>` | `iterator()` Returns an unmodifiable iterator over the expressions in this tuple.
    `` | `public String` | `toString()`
    `` | `public Expression` | `transformExpression(ExpressionTransformer transformer)`
    `` | `public void` | `visit(GroovyCodeVisitor visitor)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Expression` | `getType, setType, transformExpression, transformExpressions, transformExpressions`
    `class AnnotatedNode` | `addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`
    `class ASTNode` | `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

- - ### Constructor Detail

    - #### public TupleExpression()

      Creates an empty tuple expression with zero initial capacity.

    - #### public TupleExpression(Expression expr)

      Creates a tuple expression containing a single expression.

      Parameters:
        `expr` - the expression to add (non-null)

    - #### public TupleExpression(Expression expr1, Expression expr2)

      Creates a tuple expression containing two expressions.

      Parameters:
        `expr1` - the first expression (non-null)
        `expr2` - the second expression (non-null)

    - #### public TupleExpression(Expression expr1, Expression expr2, Expression expr3)

      Creates a tuple expression containing three expressions.

      Parameters:
        `expr1` - the first expression (non-null)
        `expr2` - the second expression (non-null)
        `expr3` - the third expression (non-null)

    - #### public TupleExpression(int capacity)

      Creates a tuple expression with pre-allocated capacity.

      Parameters:
        `capacity` - the initial capacity for the internal list

    - #### public TupleExpression(List<Expression> expressions)

      Creates a tuple expression from an existing list of expressions.

      Parameters:
        `expressions` - the list of expressions (non-null)

    - #### public TupleExpression(Expression[] expressionArray)

      Creates a tuple expression from an array of expressions.

      Parameters:
        `expressionArray` - the array of expressions (non-null)

  - ### Method Detail

    - #### public TupleExpression addExpression(Expression expression)

      Adds an expression to this tuple.

      Parameters:
        `expression` - the expression to add (non-null)
      Returns:
        this tuple expression for method chaining

    - #### public Expression getExpression(int i)

      Returns the expression at the specified index.

      throws:
        IndexOutOfBoundsException if the index is out of range
      Parameters:
        `i` - the index of the expression
      Returns:
        the expression at the specified index

    - #### public List<Expression> getExpressions()

      Returns the list of all expressions in this tuple. Note: The returned list may be mutable; modifications affect this tuple.

      Returns:
        a list of expressions (non-null)

    - #### public String getText()

    - #### public Iterator<Expression> iterator()

      Returns an unmodifiable iterator over the expressions in this tuple.

      Returns:
        an iterator of expressions

    - #### public String toString()

    - #### public Expression transformExpression(ExpressionTransformer transformer)

    - #### public void visit(GroovyCodeVisitor visitor)