public Text toText() {
// We use Text concatenation instead of TextBuilder to avoid copying
// the text representation of the record values (unknown length).
Text text = Text.valueOf("{");
for (Record r = head(), end = tail(); (r = r.getNext()) != end;) {
text = text.plus(valueOf(r));
if (r.getNext() != end) {
text = text.plus(", ");
}
}
return text.plus("}");