From 016a6410aaa21192469664ed861656f12511877a Mon Sep 17 00:00:00 2001 From: thatsIch Date: Sun, 5 Oct 2014 12:04:20 +0200 Subject: [PATCH] Implement correct Iterator type --- .../appeng/util/item/MeaningfulIterator.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/java/appeng/util/item/MeaningfulIterator.java b/src/main/java/appeng/util/item/MeaningfulIterator.java index c38bd197..dc665f27 100644 --- a/src/main/java/appeng/util/item/MeaningfulIterator.java +++ b/src/main/java/appeng/util/item/MeaningfulIterator.java @@ -4,35 +4,40 @@ import java.util.Iterator; import appeng.api.storage.data.IAEStack; -public class MeaningfulIterator implements Iterator +public class MeaningfulIterator implements Iterator { - final Iterator parent; + private final Iterator parent; private StackType next; - public MeaningfulIterator(Iterator iterator) { - parent = iterator; + public MeaningfulIterator(Iterator iterator) + { + this.parent = iterator; } @Override public boolean hasNext() { - while (parent.hasNext()) + while (this.parent.hasNext()) { - next = parent.next(); - if ( next.isMeaningful() ) + this.next = this.parent.next(); + if ( this.next.isMeaningful() ) + { return true; + } else - parent.remove(); // self cleaning :3 + { + this.parent.remove(); // self cleaning :3 + } } return false; } @Override - public Object next() + public StackType next() { - return next; + return this.next; } @Override