Foreach

For each record in the pipe, runs some operations.

public GearsBuilder<T> foreach(
    gears.operations.ForeachOperation<T> foreach)

Defines a set of operations to run for each record in the pipe.

Parameters

Name Type Description
foreach ForeachOperation The set of operations to run for each record

Returns

Returns a GearsBuilder object with a new template type.

Example

For each person hash, add a new full_name field that combines their first and last names:

GearsBuilder.CreateGearsBuilder(reader).foreach(r->{
    String firstName = r.getHashVal().get("first_name");
    String lastName = r.getHashVal().get("last_name");
   	r.getHashVal().put("full_name", firstName + lastName);
}); 
RATE THIS PAGE
Back to top ↑