nutron
09/21/2016, 10:20 AMfun Shop.getSetOfProductsOrderedByEveryCustomer(): Set<Product> {
// Return the set of products ordered by every customer
return customers.fold(allOrderedProducts, {
orderedByAll, customer ->
val customerProducts = customer.orders.flatMap { it.products }
orderedByAll.intersect(customerProducts)
})
}