本文整理汇总了Java中com.google.common.collect.Iterators.limit方法的典型用法代码示例。如果您正苦于以下问题:Java Iterators.limit方法的具体用法?Java Iterators.limit怎么用?Java Iterators.limit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Iterators
的用法示例。
在下文中一共展示了Iterators.limit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeOutput
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
public void writeOutput(Iterable<DocumentResult> documentResults, File outputDirectory)
throws IOException {
// now we compute many "samples" of possible corpora based on our existing corpus. We score each of
// these samples and compute confidence intervals from them
final Random rng = new Random(bootstrapSeed);
final Iterator<Collection<DocumentResult>> bootstrappedResults =
Iterators.limit(BootstrapIterator.forData(documentResults, rng), numBootstrapSamples);
final List<Map<String, BrokenDownSummaryConfusionMatrix<Symbol>>> resultsForSamples =
Lists.newArrayList();
while (bootstrappedResults.hasNext()) {
resultsForSamples.add(combineBreakdowns(
transform(bootstrappedResults.next(), DocumentResult.GetBreakdownMatricesFunction)
.iterator()));
}
final ImmutableMultimap<String, BrokenDownSummaryConfusionMatrix<Symbol>>
resultsByBreakdownType =
combineMapsToMultimap(resultsForSamples);
writeSampledBreakdownsToFiles(resultsByBreakdownType, outputDirectory);
}
示例2: restart
import com.google.common.collect.Iterators; //导入方法依赖的package包/类
void restart() {
activeFiles = Iterators.limit(allFilesCyclic, files.size());
}