Implement grid change in
@@ -57,11 +57,7 @@ public abstract class BaseGridView implements IGridView {
(grid.getTabSelected() >= 0 && grid.getTabSelected() < grid.getTabs().size()) ? grid.getTabs().get(grid.getTabSelected()).getFilters() : grid.getFilters()
);
- Iterator<IGridStack> it = stacks.iterator();
-
- while (it.hasNext()) {
- IGridStack stack = it.next();
-
+ stacks.removeIf(stack -> {
// If this is a crafting stack,
// and there is a regular matching stack in the view too,
// and we aren't in "view only craftables" mode,
@@ -70,20 +66,18 @@ public abstract class BaseGridView implements IGridView {
stack.isCraftable() &&
stack.getOtherId() != null &&
map.containsKey(stack.getOtherId())) {
- it.remove();
-
- continue;
+ return true;
}
for (Predicate<IGridStack> filter : filters) {
if (!filter.test(stack)) {
- it.remove();
-
- break;
- }
+ return true;
}
}
+ return false;
+ });
+
SortingDirection sortingDirection = grid.getSortingDirection() == IGrid.SORTING_DIRECTION_DESCENDING ? SortingDirection.DESCENDING : SortingDirection.ASCENDING;
stacks.sort((left, right) -> defaultSorter.compare(left, right, sortingDirection));
