Node.add

void add(T)(T value)

Add an element to a sequence.

This method can only be called on sequence nodes.

If value is a node, it is copied to the sequence directly. Otherwise value is converted to a node and then stored in the sequence.

When emitting, all values in the sequence will be emitted. When

using the !!set tag, the user needs to ensure that all elements in the sequence are unique, otherwise invalid YAML code will be emitted.

Parameters

valueValue to _add to the sequence.
void add(K, V)(K key, V value)

Add a key-value pair to a mapping.

This method can only be called on mapping nodes.

If key and/or value is a node, it is copied to the mapping directly. Otherwise it is converted to a node and then stored in the mapping.

It is possible for the same key to be present more than once in a

mapping. When emitting, all key-value pairs will be emitted. This is useful with the "!!pairs" tag, but will result in

invalid YAML with "!!map" and "!!omap" tags.

Parameters

keyKey to _add.
valueValue to _add.