@Test public void getTop2Donuts() { var expected = Lists.mutable.empty() .with(pair(DonutType.BOSTON_CREAM, 15)) .with(pair(DonutType.GLAZED, 11)); Assert.assertEquals(expected, this.donutShop.getTopDonuts(2)); }
public MutableList<ObjectIntPair<DonutType>> getTopDonuts(int n) { return this.deliveries .flatCollect(Delivery::donuts) .countBy(Donut::type) .topOccurrences(n); }
DonutShop { public MutableList<ObjectIntPair<DonutType>> getTopDonuts(int n) { return this.deliveries .flatCollect(Delivery::donuts) .countBy(Donut::type) .topOccurrences(n); } }
DonutShop { public MutableList<ObjectIntPair<DonutType>> getTopDonuts(int n) { return this.deliveries .flatCollect(Delivery::donuts) .countBy(Donut::type) .topOccurrences(n); }  }
DonutShop { public MutableList<ObjectIntPair<DonutType>> getTopDonuts(int n) { return this.deliveries .flatCollect(Delivery::donuts) .countBy(Donut::type) .topOccurrences(n); }  void makeDonuts(DonutType type, int count); Delivery deliverOrder(String customerName, LocalDate date, String donutTypeCounts); Bag<DonutType> getDonuts(); MutableList<ObjectIntPair<DonutType>> getTopDonuts(int n); double getTotalDeliveryValueFor(LocalDate date); Customer getTopCustomer(); Multimap<DonutType, Customer> getCustomersByDonutTypesOrdered(); DoubleSummaryStatistics getDonutPriceStatistics(LocalDate fromDate, LocalDate toDate); @Override String toString(); }
DonutShop { public MutableList<ObjectIntPair<DonutType>> getTopDonuts(int n) { return this.deliveries .flatCollect(Delivery::donuts) .countBy(Donut::type) .topOccurrences(n); }  void makeDonuts(DonutType type, int count); Delivery deliverOrder(String customerName, LocalDate date, String donutTypeCounts); Bag<DonutType> getDonuts(); MutableList<ObjectIntPair<DonutType>> getTopDonuts(int n); double getTotalDeliveryValueFor(LocalDate date); Customer getTopCustomer(); Multimap<DonutType, Customer> getCustomersByDonutTypesOrdered(); DoubleSummaryStatistics getDonutPriceStatistics(LocalDate fromDate, LocalDate toDate); @Override String toString();  }