Skip to content

Commit

Permalink
immutable list를 mutable하게 다루도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
MJbae committed Jan 3, 2023
1 parent e13070f commit 28576c4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/com/order/application/OrderServiceImp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class OrderServiceImp(
val result = customer.order(orderData)

itemRepository.save(item)
orderRepository.save(Order(null, result.price, result.orderItems))
orderRepository.save(Order(null, result.price, result.orderItems.toMutableList()))

return result
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/order/cli/dto/OrderResult.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import java.math.BigDecimal
class OrderResult(
val isSuccess: Boolean,
val price: BigDecimal?,
val orderItems: MutableList<OrderItem>
val orderItems: List<OrderItem>
)
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class OrderProductPrinter(
println("지불금액: ${price}")
}

private fun showPriceOrdering(orderItems: MutableList<OrderItem>) {
private fun showPriceOrdering(orderItems: List<OrderItem>) {
orderItems.forEach { orderItem ->
println("${orderItem.item.name}는 개당 ${orderItem.item.price}원, ${orderItem.quantity}개 주문")
}
Expand Down

0 comments on commit 28576c4

Please sign in to comment.