l.609-613 are equiv to:
contents += buildLine(endpoint, types.join(" "));