File tree Expand file tree Collapse file tree 3 files changed +3
-9
lines changed
src/main/java/org/scify/jedai Expand file tree Collapse file tree 3 files changed +3
-9
lines changed Original file line number Diff line number Diff line change 3030public abstract class AbstractBlockProcessing implements IBlockProcessing {
3131
3232 protected void printOriginalStatistics (List <AbstractBlock > inputBlocks ) {
33- long comparisons = 0 ;
34- for (AbstractBlock block : inputBlocks ) {
35- comparisons += block .getNoOfComparisons ();
36- }
33+ long comparisons = inputBlocks .stream ().mapToLong (AbstractBlock ::getNoOfComparisons ).sum ();
3734
3835 Log .info ("Original blocks\t :\t " + inputBlocks .size ());
3936 Log .info ("Original comparisons\t :\t " + comparisons );
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public List<AbstractBlock> refineBlocks(List<AbstractBlock> blocks) {
4949 setThreshold (newBlocks );
5050
5151 int noOfPurgedBlocks = 0 ;
52- float totalComparisons = 0 ;
52+ long totalComparisons = 0 ;
5353 final Iterator <AbstractBlock > blocksIterator = newBlocks .iterator ();
5454 while (blocksIterator .hasNext ()) {
5555 AbstractBlock aBlock = blocksIterator .next ();
Original file line number Diff line number Diff line change @@ -57,10 +57,7 @@ public void addComparison(Comparison comparison) {
5757 }
5858
5959 private long countComparisons (List <AbstractBlock > blocks ) {
60- long comparisons = 0 ;
61- for (AbstractBlock block : blocks ) {
62- comparisons += block .getNoOfComparisons ();
63- }
60+ long comparisons = blocks .stream ().mapToLong (AbstractBlock ::getNoOfComparisons ).sum ();
6461
6562 if (comparisons > MAX_COMPARISONS ) {
6663 throw new IllegalStateException ("Very high number of comparisons to be executed. "
You can’t perform that action at this time.
0 commit comments