Skip to content

Commit

Permalink
Remove some further unnecessary Stream usage
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Jan 17, 2025
1 parent f94f788 commit 157303a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/main/java/gripe/_90/megacells/misc/CompressionService.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package gripe._90.megacells.misc;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedList;
Expand Down Expand Up @@ -237,10 +236,24 @@ private static boolean isIrreversible(
var input = candidate.getIngredients().getFirst().getItems();
var output = candidate.getResultItem(access).getItem();

// spotless:off
var compressible = Arrays.stream(input).anyMatch(i -> i.is(testOutput) && !i.is(MEGATags.COMPRESSION_BLACKLIST));
var decompressible = Arrays.stream(testInput).anyMatch(i -> i.is(output) && !i.is(MEGATags.COMPRESSION_BLACKLIST));
var compressible = false;
var decompressible = false;

for (var i : input) {
if (i.is(testOutput) && !i.is(MEGATags.COMPRESSION_BLACKLIST)) {
compressible = true;
break;
}
}

for (var i : testInput) {
if (i.is(output) && !i.is(MEGATags.COMPRESSION_BLACKLIST)) {
decompressible = true;
break;
}
}

// spotless:off
var sameQuantity = candidate.getResultItem(access).getCount() == recipe.getIngredients().size()
&& recipe.getResultItem(access).getCount() == candidate.getIngredients().size();
// spotless:on
Expand Down

0 comments on commit 157303a

Please sign in to comment.