diff --git a/src/main/java/appeng/util/item/ItemList.java b/src/main/java/appeng/util/item/ItemList.java index a5b1c95d..08a54fd9 100644 --- a/src/main/java/appeng/util/item/ItemList.java +++ b/src/main/java/appeng/util/item/ItemList.java @@ -1,20 +1,30 @@ + package appeng.util.item; -import java.util.*; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.NavigableMap; +import java.util.concurrent.ConcurrentSkipListMap; + +import com.google.common.collect.Lists; import net.minecraftforge.oredict.OreDictionary; + import appeng.api.config.FuzzyMode; import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEStack; import appeng.api.storage.data.IItemList; -import com.google.common.collect.Lists; public final class ItemList implements IItemList { - private final TreeMap records = new TreeMap(); + private final NavigableMap records = new ConcurrentSkipListMap(); private final Class clz; // private int currentPriority = Integer.MIN_VALUE; @@ -22,12 +32,12 @@ public final class ItemList implements IItemList cla) + public ItemList( Class cla ) { clz = cla; } - private boolean checkStackType(StackType st) + private boolean checkStackType( StackType st ) { if ( st == null ) return true; @@ -39,7 +49,7 @@ public final class ItemList implements IItemList implements IItemList implements IItemList implements IItemList implements IItemList implements IItemList implements IItemList implements IItemList implements IItemList implements IItemList findFuzzyDamage(AEItemStack filter, FuzzyMode fuzzy, boolean ignoreMeta) + public Collection findFuzzyDamage( AEItemStack filter, FuzzyMode fuzzy, boolean ignoreMeta ) { - StackType low = (StackType) filter.getLow( fuzzy, ignoreMeta ); - StackType high = (StackType) filter.getHigh( fuzzy, ignoreMeta ); + StackType low = ( StackType ) filter.getLow( fuzzy, ignoreMeta ); + StackType high = ( StackType ) filter.getHigh( fuzzy, ignoreMeta ); return records.subMap( low, true, high, true ).descendingMap().values(); } @Override - public Collection findFuzzy(StackType filter, FuzzyMode fuzzy) + public Collection findFuzzy( StackType filter, FuzzyMode fuzzy ) { if ( checkStackType( filter ) ) return new ArrayList(); @@ -209,21 +219,21 @@ public final class ItemList implements IItemList output = new LinkedList(); - for (IAEItemStack is : or.getAEEquivalents()) - output.addAll( findFuzzyDamage( (AEItemStack) is, fuzzy, is.getItemDamage() == OreDictionary.WILDCARD_VALUE ) ); + for ( IAEItemStack is : or.getAEEquivalents() ) + output.addAll( findFuzzyDamage( ( AEItemStack ) is, fuzzy, is.getItemDamage() == OreDictionary.WILDCARD_VALUE ) ); return output; }