Maybe use a simple for loop here like:

```Java

if (!contextMapping.isEmpty()) {
  builder.startArray(Fields.CONTEXT);
  for (ContextMapping c : contextMapping) {
    builder.value(c);
  }
  builder.endArray();
}
```