/** * Add a result to the accumulator. * @param r The result to add. */ public void add(@Nonnull Result r) { accum.add(r); }
@Test public void testUnlimitedAddOne() { SortedListAccumulator<String> acc = SortedListAccumulator.decreasing(-1); acc.add("foo"); List<String> res = acc.finish(); assertThat(res, hasSize(1)); assertThat(res, contains("foo")); }
@Test public void testLimitedAddOne() { SortedListAccumulator<String> acc = SortedListAccumulator.decreasing(5); acc.add("foo"); List<String> res = acc.finish(); assertThat(res, hasSize(1)); assertThat(res, contains("foo")); }
SortedListAccumulator<Neighbor> heap = heaps.get(item); if (heap != null) { heap.add(nbr);
/** * Add a result to the accumulator. * @param r The result to add. */ public void add(@Nonnull Result r) { accum.add(r); }
SortedListAccumulator<Neighbor> heap = heaps.get(item); if (heap != null) { heap.add(nbr);