fun Sequence<String>.toHighValueCustomerReport(): Sequence<String> {
val valuableCustomers = this
.withoutHeader()
.map(String::toCustomerData)
.filter { it.score >= 10 }
.sortedBy(CustomerData::score)
.toList()
return sequenceOf(“ID\tName\tSpend”) +
valuableCustomers.map(CustomerData::outputLine) +
valuableCustomers.summarised()
}
20.5
다음으로 나아가기
이 리팩터링은 코드를 단순화하려는 욕구로 인해 시작됐다.
I
/
O
를 프로그램 진입점으로 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.