Back to blog
documentation

Map

Map is the operation that transforms sequence of objects to the sequence of other objects using map function.

Syntax

MapStage
  : 'map' '(' LambdaExpression ')'  
  ;

Related tokens

[LambdaExpression](../expression/lambda)

Map examples

For each table in a PDF take the text content

select(tables) // PdfTable[]
    ->map((item) => item.Text()) // string[]

For each table row get first cell text as 'Name' and second cell as 'Description.'

select(tableRows) // PdfTable[]
    ->map((row) => new { Title = row.GetCell(1).Text(), Description = row.GetCell(2).Text() }) // object[]