@Test public void shouldLoadBatchOfEntriesWhenAskingForNextBatchOfGivenSize() { InMemoryParameter parameter = new InMemoryParameter(); parameter.addEntry(new InMemoryParameterEntry()); parameter.addEntry(new InMemoryParameterEntry()); parameter.addEntry(new InMemoryParameterEntry()); InMemoryParameterEntryBatchLoader batchLoader = new InMemoryParameterEntryBatchLoader(parameter); Collection<ParameterEntry> entries = batchLoader.nextBatch(2); assertThat(entries).hasSize(2); }
@Override public Collection<ParameterEntry> nextBatch(int batchSize) { Set<ParameterEntry> entriesBatch = new HashSet<ParameterEntry>(); for (int index = 0; index < batchSize && entryIterator.hasNext(); ++index) { entriesBatch.add(entryIterator.next()); } return entriesBatch; }
InMemoryParameterEntryBatchLoader implements ParameterEntryBatchLoader { @Override public Collection<ParameterEntry> nextBatch(int batchSize) { Set<ParameterEntry> entriesBatch = new HashSet<ParameterEntry>(); for (int index = 0; index < batchSize && entryIterator.hasNext(); ++index) { entriesBatch.add(entryIterator.next()); } return entriesBatch; } }
InMemoryParameterEntryBatchLoader implements ParameterEntryBatchLoader { @Override public Collection<ParameterEntry> nextBatch(int batchSize) { Set<ParameterEntry> entriesBatch = new HashSet<ParameterEntry>(); for (int index = 0; index < batchSize && entryIterator.hasNext(); ++index) { entriesBatch.add(entryIterator.next()); } return entriesBatch; } InMemoryParameterEntryBatchLoader(Parameter parameter); }
InMemoryParameterEntryBatchLoader implements ParameterEntryBatchLoader { @Override public Collection<ParameterEntry> nextBatch(int batchSize) { Set<ParameterEntry> entriesBatch = new HashSet<ParameterEntry>(); for (int index = 0; index < batchSize && entryIterator.hasNext(); ++index) { entriesBatch.add(entryIterator.next()); } return entriesBatch; } InMemoryParameterEntryBatchLoader(Parameter parameter); @Override boolean hasMore(); @Override Collection<ParameterEntry> nextBatch(int batchSize); @Override void close(); }
InMemoryParameterEntryBatchLoader implements ParameterEntryBatchLoader { @Override public Collection<ParameterEntry> nextBatch(int batchSize) { Set<ParameterEntry> entriesBatch = new HashSet<ParameterEntry>(); for (int index = 0; index < batchSize && entryIterator.hasNext(); ++index) { entriesBatch.add(entryIterator.next()); } return entriesBatch; } InMemoryParameterEntryBatchLoader(Parameter parameter); @Override boolean hasMore(); @Override Collection<ParameterEntry> nextBatch(int batchSize); @Override void close();  }