Skip to content

Collections/Partition promotes inefficient code #45

@rwst

Description

@rwst

The task description suggests to use partitions but it is wasteful because this should work too:

// Return customers who have more undelivered orders than delivered
fun Shop.getCustomersWithMoreUndeliveredOrders(): Set<Customer> =
    customers.filter {
        it.orders.count { it.isDelivered } < it.orders.size / 2
    }.toSet()

But it is not accepted:

java.lang.AssertionError: The function 'getCustomersWithMoreUndeliveredOrders' is implemented incorrectly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions