Skip to content

Commit 93a85a9

Browse files
committed
ch01: 공연 객체 복사하여 전달
1 parent 7a730ff commit 93a85a9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/kotlin/chapter01/Statement.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ import java.util.Locale.US
66
fun statement(invoice: Invoice, plays: Plays): String {
77
val statementData = mutableMapOf<String, Any>()
88
statementData.put("customer", invoice.customer)
9-
statementData.put("performances", invoice.performances)
9+
10+
fun enrichPerformance(performance: Performance): Performance {
11+
val result = performance.copy()
12+
return result
13+
}
14+
statementData.put("performances", invoice.performances.map { enrichPerformance(it) })
15+
1016
return renderPlainText(statementData, plays)
1117
}
1218

0 commit comments

Comments
 (0)