Skip to content

Commit

Permalink
ii_collections/_21_Partition
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Lotz committed Dec 29, 2017
1 parent 974d529 commit c412784
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ii_collections/n21Partition.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ fun example8() {
}

fun Shop.getCustomersWithMoreUndeliveredOrdersThanDelivered(): Set<Customer> {
// Return customers who have more undelivered orders than delivered
todoCollectionTask()
return customers.filter {
val (delivered, undelivered) = it.orders.partition { it.isDelivered }

undelivered.size > delivered.size
}.toSet()
}

0 comments on commit c412784

Please sign in to comment.