withAttributes

The withAttributes method returns a table with an AttributeMap identical to the source table's, but with the specified attributes added/replaced. If the supplied attributes toAdd would not result in any changes, the original object may be returned.

Syntax

Parameters

ParameterTypeDescription
toAdd>Map<String,Object>

Attribute key-value pairs to add or replace (if the key already exists in the source table's AttributeMap). Neither keys nor values may be null.

toRemove>Collection<String>

Attribute keys to remove.

Returns

A table with an AttributeMap that is the same as the source table's, but with the specified attributes added or removed.

Examples

In this example, we create a source table, then create a result table with a call to withAttributes(). This returns a result table that is identical to our source table, but with the attribute we specify ("MyAttribute") added.