@Test(timeout = 300000) public void testHasNext() throws Exception { File file = Resources.asFile("/big/raw_sentences.txt"); BasicLineIterator iterator = new BasicLineIterator(file); BasicLineIterator iterator2 = new BasicLineIterator(file); AggregatingSentenceIterator aggr = new AggregatingSentenceIterator.Builder().addSentenceIterator(iterator) .addSentenceIterator(iterator2).build(); int cnt = 0; while (aggr.hasNext()) { String line = aggr.nextSentence(); cnt++; } assertEquals((97162 * 2), cnt); aggr.reset(); while (aggr.hasNext()) { String line = aggr.nextSentence(); cnt++; } assertEquals((97162 * 4), cnt); }
@Override public boolean hasNext() { for (SentenceIterator iterator : backendIterators) { if (iterator.hasNext()) { return true; } } return false; }
AggregatingSentenceIterator implements SentenceIterator { @Override public boolean hasNext() { for (SentenceIterator iterator : backendIterators) { if (iterator.hasNext()) { return true; } } return false; } }
AggregatingSentenceIterator implements SentenceIterator { @Override public boolean hasNext() { for (SentenceIterator iterator : backendIterators) { if (iterator.hasNext()) { return true; } } return false; } private  AggregatingSentenceIterator(@NonNull List<SentenceIterator> list); }
AggregatingSentenceIterator implements SentenceIterator { @Override public boolean hasNext() { for (SentenceIterator iterator : backendIterators) { if (iterator.hasNext()) { return true; } } return false; } private  AggregatingSentenceIterator(@NonNull List<SentenceIterator> list); @Override String nextSentence(); @Override boolean hasNext(); @Override void reset(); @Override void finish(); @Override SentencePreProcessor getPreProcessor(); @Override void setPreProcessor(SentencePreProcessor preProcessor); }
AggregatingSentenceIterator implements SentenceIterator { @Override public boolean hasNext() { for (SentenceIterator iterator : backendIterators) { if (iterator.hasNext()) { return true; } } return false; } private  AggregatingSentenceIterator(@NonNull List<SentenceIterator> list); @Override String nextSentence(); @Override boolean hasNext(); @Override void reset(); @Override void finish(); @Override SentencePreProcessor getPreProcessor(); @Override void setPreProcessor(SentencePreProcessor preProcessor);  }