diff --git a/src/main/java/org/scify/jedai/blockprocessing/AbstractBlockProcessing.java b/src/main/java/org/scify/jedai/blockprocessing/AbstractBlockProcessing.java index 5d3f78b..9c447f7 100644 --- a/src/main/java/org/scify/jedai/blockprocessing/AbstractBlockProcessing.java +++ b/src/main/java/org/scify/jedai/blockprocessing/AbstractBlockProcessing.java @@ -30,10 +30,7 @@ public abstract class AbstractBlockProcessing implements IBlockProcessing { protected void printOriginalStatistics(List inputBlocks) { - long comparisons = 0; - for (AbstractBlock block : inputBlocks) { - comparisons += block.getNoOfComparisons(); - } + long comparisons = inputBlocks.stream().mapToLong(AbstractBlock::getNoOfComparisons).sum(); Log.info("Original blocks\t:\t" + inputBlocks.size()); Log.info("Original comparisons\t:\t" + comparisons); diff --git a/src/main/java/org/scify/jedai/blockprocessing/blockcleaning/AbstractBlockPurging.java b/src/main/java/org/scify/jedai/blockprocessing/blockcleaning/AbstractBlockPurging.java index adfd287..8dbbc0f 100644 --- a/src/main/java/org/scify/jedai/blockprocessing/blockcleaning/AbstractBlockPurging.java +++ b/src/main/java/org/scify/jedai/blockprocessing/blockcleaning/AbstractBlockPurging.java @@ -49,7 +49,7 @@ public List refineBlocks(List blocks) { setThreshold(newBlocks); int noOfPurgedBlocks = 0; - float totalComparisons = 0; + long totalComparisons = 0; final Iterator blocksIterator = newBlocks.iterator(); while (blocksIterator.hasNext()) { AbstractBlock aBlock = blocksIterator.next(); diff --git a/src/main/java/org/scify/jedai/datamodel/SimilarityPairs.java b/src/main/java/org/scify/jedai/datamodel/SimilarityPairs.java index b084d05..4cfa7bc 100644 --- a/src/main/java/org/scify/jedai/datamodel/SimilarityPairs.java +++ b/src/main/java/org/scify/jedai/datamodel/SimilarityPairs.java @@ -57,10 +57,7 @@ public void addComparison(Comparison comparison) { } private long countComparisons(List blocks) { - long comparisons = 0; - for (AbstractBlock block : blocks) { - comparisons += block.getNoOfComparisons(); - } + long comparisons = blocks.stream().mapToLong(AbstractBlock::getNoOfComparisons).sum(); if (comparisons > MAX_COMPARISONS) { throw new IllegalStateException("Very high number of comparisons to be executed. "