Interface ListBuilder


@Experimental public interface ListBuilder

Appends the entries of one LIST instance.

The verb matches the list's element type: a list of primitives takes addString(String) and its siblings, a list of structs takes addStruct(Consumer), and a list of lists or of maps takes addList(Consumer) / addMap(Consumer). Using a verb the element type does not fit throws at the call.

row.setList("phones", phones -> phones
        .addString("+49 30 1234567")
        .addString("+1 415 5550100"));

Every entry the filler appends is one element of the list, in the order appended. A filler that appends nothing writes an empty list, which is distinct from the absent list that leaving the field unset writes.

The builder is valid only inside the lambda it was passed to. Retaining one and using it afterwards throws IllegalStateException rather than appending to a later list.

This API is Experimental: the shape may change in future releases.