Replaced LinkedList with ArrayList or ArrayDeque when applicable. (#3392)

This commit is contained in:
yueh
2018-05-27 21:15:50 +02:00
committed by GitHub
parent 62435a65f1
commit d7b97fa7b8
37 changed files with 118 additions and 117 deletions
@@ -22,11 +22,11 @@ package appeng.client.gui;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -84,7 +84,7 @@ import appeng.helpers.InventoryAction;
public abstract class AEBaseGui extends GuiContainer
{
private final List<InternalSlotME> meSlots = new LinkedList<>();
private final List<InternalSlotME> meSlots = new ArrayList<>();
// drag y
private final Set<Slot> drag_click = new HashSet<>();
private final StackSizeRenderer stackSizeRenderer = new StackSizeRenderer();
@@ -23,7 +23,6 @@ import java.io.IOException;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import com.google.common.base.Joiner;
@@ -238,7 +237,7 @@ public class GuiCraftConfirm extends AEBaseGui
final int viewEnd = viewStart + 3 * this.rows;
String dspToolTip = "";
final List<String> lineList = new LinkedList<>();
final List<String> lineList = new ArrayList<>();
int toolPosX = 0;
int toolPosY = 0;
@@ -22,7 +22,6 @@ package appeng.client.gui.implementations;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -212,7 +211,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
final int viewEnd = viewStart + 3 * 6;
String dspToolTip = "";
final List<String> lineList = new LinkedList<>();
final List<String> lineList = new ArrayList<>();
int toolPosX = 0;
int toolPosY = 0;
+2 -2
View File
@@ -22,9 +22,9 @@ package appeng.core.api;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -75,7 +75,7 @@ public class ApiPart implements IPartHelper
} );
private final Map<Class<?>, String> interfaces2Layer = new HashMap<>();
private final List<String> desc = new LinkedList<>();
private final List<String> desc = new ArrayList<>();
/**
* Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a
@@ -19,9 +19,10 @@
package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
@@ -39,8 +40,8 @@ public class MovableTileRegistry implements IMovableRegistry
private final HashSet<Block> blacklisted = new HashSet<>();
private final HashMap<Class<? extends TileEntity>, IMovableHandler> Valid = new HashMap<>();
private final LinkedList<Class<? extends TileEntity>> test = new LinkedList<>();
private final LinkedList<IMovableHandler> handlers = new LinkedList<>();
private final List<Class<? extends TileEntity>> test = new ArrayList<>();
private final List<IMovableHandler> handlers = new ArrayList<>();
private final DefaultSpatialHandler dsh = new DefaultSpatialHandler();
private final IMovableHandler nullHandler = new DefaultSpatialHandler();
@@ -19,9 +19,9 @@
package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map;
@@ -44,7 +44,7 @@ import appeng.recipes.RecipeHandler;
public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
{
private final Map<String, Class<? extends ICraftHandler>> handlers = new HashMap<>( 20 );
private final Collection<ISubItemResolver> resolvers = new LinkedList<>();
private final Collection<ISubItemResolver> resolvers = new ArrayList<>();
@Override
public void addNewCraftHandler( final String name, final Class<? extends ICraftHandler> handler )
@@ -23,7 +23,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.BufferOverflowException;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
@@ -77,7 +77,7 @@ public class PacketMEInventoryUpdate extends AppEngPacket
{
this.data = null;
this.compressFrame = null;
this.list = new LinkedList<>();
this.list = new ArrayList<>();
this.ref = stream.readByte();
// int originalBytes = stream.readableBytes();
@@ -23,8 +23,8 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import javax.annotation.Nonnull;
@@ -101,7 +101,7 @@ final class SpawnData implements IWorldSpawnData
@Override
public Collection<NBTTagCompound> getNearByMeteorites( final int dim, final int chunkX, final int chunkZ )
{
final Collection<NBTTagCompound> ll = new LinkedList<>();
final Collection<NBTTagCompound> ll = new ArrayList<>();
synchronized( SpawnData.class )
{
@@ -21,7 +21,6 @@ package appeng.crafting;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import com.google.common.collect.Lists;
@@ -122,7 +121,7 @@ public class CraftingTreeNode
{
this.job.handlePausing();
final List<IAEItemStack> thingsUsed = new LinkedList<>();
final List<IAEItemStack> thingsUsed = new ArrayList<>();
this.what.setStackSize( l );
if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() )
+2 -2
View File
@@ -19,7 +19,7 @@
package appeng.debug;
import java.util.LinkedList;
import java.util.ArrayDeque;
import java.util.Queue;
import javax.annotation.Nonnull;
@@ -40,7 +40,7 @@ import appeng.tile.AEBaseTile;
public class TileItemGen extends AEBaseTile
{
private static final Queue<ItemStack> POSSIBLE_ITEMS = new LinkedList<>();
private static final Queue<ItemStack> POSSIBLE_ITEMS = new ArrayDeque<>();
private final IItemHandler handler = new QueuedItemHandler();
+3 -3
View File
@@ -19,7 +19,7 @@
package appeng.debug;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.state.IBlockState;
@@ -50,14 +50,14 @@ public class ToolEraser extends AEBaseItem
final IBlockState state = world.getBlockState( pos );
List<BlockPos> next = new LinkedList<>();
List<BlockPos> next = new ArrayList<>();
next.add( pos );
int blocks = 0;
while( blocks < BLOCK_ERASE_LIMIT && !next.isEmpty() )
{
final List<BlockPos> c = next;
next = new LinkedList<>();
next = new ArrayList<>();
for( final BlockPos wc : c )
{
@@ -19,11 +19,11 @@
package appeng.helpers;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
@@ -274,7 +274,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
if( this.waitingToSend == null )
{
this.waitingToSend = new LinkedList<>();
this.waitingToSend = new ArrayList<>();
}
this.waitingToSend.add( is );
@@ -491,7 +491,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
{
if( this.craftingList == null )
{
this.craftingList = new LinkedList<>();
this.craftingList = new ArrayList<>();
}
this.craftingList.add( details );
+8 -7
View File
@@ -19,11 +19,13 @@
package appeng.hooks;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Set;
import java.util.WeakHashMap;
@@ -60,7 +62,7 @@ public class TickHandler
{
public static final TickHandler INSTANCE = new TickHandler();
private final Queue<IWorldCallable<?>> serverQueue = new LinkedList<>();
private final Queue<IWorldCallable<?>> serverQueue = new ArrayDeque<>();
private final Multimap<World, CraftingJob> craftingJobs = LinkedListMultimap.create();
private final WeakHashMap<World, Queue<IWorldCallable<?>>> callQueue = new WeakHashMap<>();
private final HandlerRep server = new HandlerRep();
@@ -90,7 +92,7 @@ public class TickHandler
if( queue == null )
{
queue = new LinkedList<>();
queue = new ArrayDeque<>();
this.callQueue.put( w, queue );
}
@@ -146,7 +148,7 @@ public class TickHandler
{
if( Platform.isServer() ) // for no there is no reason to care about this on the client...
{
final LinkedList<IGridNode> toDestroy = new LinkedList<>();
final List<IGridNode> toDestroy = new ArrayList<>();
this.getRepo().updateNetworks();
for( final Grid g : this.getRepo().networks )
@@ -296,15 +298,14 @@ public class TickHandler
private static class HandlerRep
{
private Queue<AEBaseTile> tiles = new LinkedList<>();
private Queue<AEBaseTile> tiles = new ArrayDeque<>();
private Set<Grid> networks = new HashSet<>();
private Set<Grid> toAdd = new HashSet<>();
private Set<Grid> toRemove = new HashSet<>();
private void clear()
{
this.tiles = new LinkedList<>();
this.tiles = new ArrayDeque<>();
this.networks = new HashSet<>();
this.toAdd = new HashSet<>();
this.toRemove = new HashSet<>();
@@ -19,8 +19,8 @@
package appeng.integration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import net.minecraftforge.fml.relauncher.Side;
@@ -30,7 +30,7 @@ public enum IntegrationRegistry
{
INSTANCE;
private final Collection<IntegrationNode> modules = new LinkedList<>();
private final Collection<IntegrationNode> modules = new ArrayList<>();
public void add( final IntegrationType type )
{
@@ -20,7 +20,7 @@ package appeng.integration.modules.jei;
import java.io.IOException;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -92,7 +92,7 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
if( slot.getSlotIndex() == slotIndex )
{
final NBTTagList tags = new NBTTagList();
final List<ItemStack> list = new LinkedList<>();
final List<ItemStack> list = new ArrayList<>();
final ItemStack displayed = ingredient.getDisplayedIngredient();
// prefer currently displayed item
@@ -19,11 +19,11 @@
package appeng.items.materials;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -106,7 +106,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
final Upgrades u = this.getType( stack );
if( u != null )
{
final List<String> textList = new LinkedList<>();
final List<String> textList = new ArrayList<>();
for( final Entry<ItemStack, Integer> j : u.getSupported().entrySet() )
{
String name = null;
@@ -357,7 +357,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( blk instanceof BlockColored )
{
final EnumDyeColor color = (EnumDyeColor) state.getValue( BlockColored.COLOR );
final EnumDyeColor color = state.getValue( BlockColored.COLOR );
if( newColor.dye == color )
{
@@ -374,7 +374,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( blk == Blocks.STAINED_GLASS )
{
final EnumDyeColor color = (EnumDyeColor) state.getValue( BlockStainedGlass.COLOR );
final EnumDyeColor color = state.getValue( BlockStainedGlass.COLOR );
if( newColor.dye == color )
{
@@ -391,7 +391,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( blk == Blocks.STAINED_GLASS_PANE )
{
final EnumDyeColor color = (EnumDyeColor) state.getValue( BlockStainedGlassPane.COLOR );
final EnumDyeColor color = state.getValue( BlockStainedGlassPane.COLOR );
if( newColor.dye == color )
{
+7 -6
View File
@@ -19,11 +19,12 @@
package appeng.me;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.EnumSet;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
@@ -64,7 +65,7 @@ public class GridNode implements IGridNode, IPathItem
private static final MENetworkChannelsChanged EVENT = new MENetworkChannelsChanged();
private static final int[] CHANNEL_COUNT = { 0, 8, 32 };
private final List<IGridConnection> connections = new LinkedList<>();
private final List<IGridConnection> connections = new ArrayList<>();
private final IGridBlock gridProxy;
// old power draw, used to diff
private double previousDraw = 0.0;
@@ -163,14 +164,14 @@ public class GridNode implements IGridNode, IPathItem
{
final Object tracker = new Object();
LinkedList<GridNode> nextRun = new LinkedList<>();
Deque<GridNode> nextRun = new ArrayDeque<>();
nextRun.add( this );
this.visitorIterationNumber = tracker;
if( g instanceof IGridConnectionVisitor )
{
final LinkedList<IGridConnection> nextConn = new LinkedList<>();
final Deque<IGridConnection> nextConn = new ArrayDeque<>();
final IGridConnectionVisitor gcv = (IGridConnectionVisitor) g;
while( !nextRun.isEmpty() )
@@ -181,7 +182,7 @@ public class GridNode implements IGridNode, IPathItem
}
final Iterable<GridNode> thisRun = nextRun;
nextRun = new LinkedList<>();
nextRun = new ArrayDeque<>();
for( final GridNode n : thisRun )
{
@@ -194,7 +195,7 @@ public class GridNode implements IGridNode, IPathItem
while( !nextRun.isEmpty() )
{
final Iterable<GridNode> thisRun = nextRun;
nextRun = new LinkedList<>();
nextRun = new ArrayDeque<>();
for( final GridNode n : thisRun )
{
+3 -3
View File
@@ -19,10 +19,10 @@
package appeng.me.cache;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -215,7 +215,7 @@ public class GridStorageCache implements IStorageGrid
{
this.storageNetworks.clear();
final List<ICellProvider> ll = new LinkedList<ICellProvider>();
final List<ICellProvider> ll = new ArrayList<ICellProvider>();
ll.addAll( this.inactiveCellProviders );
ll.addAll( this.activeCellProviders );
@@ -331,7 +331,7 @@ public class GridStorageCache implements IStorageGrid
private class CellChangeTracker<T extends IAEStack<T>>
{
final List<CellChangeTrackerRecord<T>> data = new LinkedList<>();
final List<CellChangeTrackerRecord<T>> data = new ArrayList<>();
public void postChanges( final IStorageChannel<T> channel, final int i, final IMEInventoryHandler<T> h, final IActionSource actionSrc )
{
+3 -3
View File
@@ -19,10 +19,10 @@
package appeng.me.cache;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -63,7 +63,7 @@ import appeng.tile.networking.TileController;
public class PathGridCache implements IPathingGrid
{
private final LinkedList<PathSegment> active = new LinkedList<>();
private final List<PathSegment> active = new ArrayList<>();
private final Set<TileController> controllers = new HashSet<>();
private final Set<IGridNode> requireChannels = new HashSet<>();
private final Set<IGridNode> blockDense = new HashSet<>();
@@ -154,7 +154,7 @@ public class PathGridCache implements IPathingGrid
final GridConnection gc = (GridConnection) gcc;
if( !( gc.getOtherSide( node ).getMachine() instanceof TileController ) )
{
final List<IPathItem> open = new LinkedList<>();
final List<IPathItem> open = new ArrayList<>();
closedList.add( gc );
open.add( gc );
gc.setControllerRoute( (GridNode) node, true );
+3 -3
View File
@@ -19,8 +19,8 @@
package appeng.me.cache;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import appeng.api.networking.IGrid;
@@ -47,7 +47,7 @@ public class SpatialPylonCache implements ISpatialCache
private DimensionalCoord captureMin;
private DimensionalCoord captureMax;
private boolean isValid = false;
private List<TileSpatialIOPort> ioPorts = new LinkedList<>();
private List<TileSpatialIOPort> ioPorts = new ArrayList<>();
private HashMap<SpatialPylonCluster, SpatialPylonCluster> clusters = new HashMap<>();
public SpatialPylonCache( final IGrid g )
@@ -65,7 +65,7 @@ public class SpatialPylonCache implements ISpatialCache
{
this.clusters = new HashMap<>();
this.ioPorts = new LinkedList<>();
this.ioPorts = new ArrayList<>();
for( final IGridNode gm : grid.getMachines( TileSpatialIOPort.class ) )
{
@@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -90,9 +90,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
private final int[] usedOps = new int[3];
private final Map<ICraftingPatternDetails, TaskProgress> tasks = new HashMap<>();
// INSTANCE sate
private final LinkedList<TileCraftingTile> tiles = new LinkedList<>();
private final LinkedList<TileCraftingTile> storage = new LinkedList<>();
private final LinkedList<TileCraftingMonitorTile> status = new LinkedList<>();
private final List<TileCraftingTile> tiles = new ArrayList<>();
private final List<TileCraftingTile> storage = new ArrayList<>();
private final List<TileCraftingMonitorTile> status = new ArrayList<>();
private final HashMap<IMEMonitorHandlerReceiver<IAEItemStack>, Object> listeners = new HashMap<>();
private ICraftingLink myLastLink;
private String myName = "";
@@ -207,7 +207,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU
te.setCoreBlock( false );
te.markDirty();
this.tiles.push( te );
this.tiles.add( 0, te );
if( te.isStorage() )
{
@@ -19,8 +19,9 @@
package appeng.me.helpers;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import com.google.common.collect.Multimap;
@@ -31,7 +32,7 @@ public class GenericInterestManager<T>
{
private final Multimap<IAEStack, T> container;
private LinkedList<SavedTransactions> transactions = null;
private List<SavedTransactions> transactions = null;
private int transDepth = 0;
public GenericInterestManager( final Multimap<IAEStack, T> interests )
@@ -43,7 +44,7 @@ public class GenericInterestManager<T>
{
if( this.transDepth == 0 )
{
this.transactions = new LinkedList<>();
this.transactions = new ArrayList<>();
}
this.transDepth++;
@@ -55,7 +56,7 @@ public class GenericInterestManager<T>
if( this.transDepth == 0 )
{
final LinkedList<SavedTransactions> myActions = this.transactions;
final List<SavedTransactions> myActions = this.transactions;
this.transactions = null;
for( final SavedTransactions t : myActions )
@@ -19,9 +19,9 @@
package appeng.me.pathfinding;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -52,7 +52,7 @@ public class PathSegment
public boolean step()
{
final List<IPathItem> oldOpen = this.open;
this.open = new LinkedList<>();
this.open = new ArrayList<>();
for( final IPathItem i : oldOpen )
{
@@ -19,10 +19,11 @@
package appeng.me.storage;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Deque;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.NavigableMap;
import java.util.TreeMap;
@@ -45,8 +46,8 @@ import appeng.util.ItemSorters;
public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHandler<T>
{
private static final ThreadLocal<LinkedList> DEPTH_MOD = new ThreadLocal<>();
private static final ThreadLocal<LinkedList> DEPTH_SIM = new ThreadLocal<>();
private static final ThreadLocal<Deque> DEPTH_MOD = new ThreadLocal<>();
private static final ThreadLocal<Deque> DEPTH_SIM = new ThreadLocal<>();
private static final Comparator<Integer> PRIORITY_SORTER = ( o1, o2 ) -> ItemSorters.compareInt( o2, o1 );
private static int currentPass = 0;
@@ -125,7 +126,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
private boolean diveList( final NetworkInventoryHandler<T> networkInventoryHandler, final Actionable type )
{
final LinkedList cDepth = this.getDepth( type );
final Deque cDepth = this.getDepth( type );
if( cDepth.contains( networkInventoryHandler ) )
{
return true;
@@ -180,15 +181,15 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
}
}
private LinkedList getDepth( final Actionable type )
private Deque getDepth( final Actionable type )
{
final ThreadLocal<LinkedList> depth = type == Actionable.MODULATE ? DEPTH_MOD : DEPTH_SIM;
final ThreadLocal<Deque> depth = type == Actionable.MODULATE ? DEPTH_MOD : DEPTH_SIM;
LinkedList s = depth.get();
Deque s = depth.get();
if( s == null )
{
depth.set( s = new LinkedList() );
depth.set( s = new ArrayDeque<>() );
}
return s;
@@ -263,7 +264,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
private boolean diveIteration( final NetworkInventoryHandler<T> networkInventoryHandler, final Actionable type )
{
final LinkedList cDepth = this.getDepth( type );
final Deque cDepth = this.getDepth( type );
if( cDepth.isEmpty() )
{
currentPass++;
@@ -20,8 +20,8 @@ package appeng.parts;
import java.io.IOException;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Set;
@@ -412,7 +412,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
final IPart p = this.getPart( side );
if( p != null )
{
final List<AxisAlignedBB> boxes = new LinkedList<>();
final List<AxisAlignedBB> boxes = new ArrayList<>();
final IPartCollisionHelper bch = new BusCollisionHelper( boxes, side, null, true );
p.getBoxes( bch );
@@ -435,7 +435,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
final IFacadePart p = fc.getFacade( side );
if( p != null )
{
final List<AxisAlignedBB> boxes = new LinkedList<>();
final List<AxisAlignedBB> boxes = new ArrayList<>();
final IPartCollisionHelper bch = new BusCollisionHelper( boxes, side, null, true );
p.getBoxes( bch, null );
@@ -465,7 +465,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
{
if( this.getCenter() == null )
{
final List<ItemStack> facades = new LinkedList<>();
final List<ItemStack> facades = new ArrayList<>();
final IFacadeContainer fc = this.getFacadeContainer();
for( final AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
@@ -735,7 +735,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final boolean ignoreConnections, final boolean includeFacades, final Entity e, final boolean visual )
{
final List<AxisAlignedBB> boxes = new LinkedList<>();
final List<AxisAlignedBB> boxes = new ArrayList<>();
final IFacadeContainer fc = this.getFacadeContainer();
for( final AEPartLocation s : AEPartLocation.values() )
@@ -19,7 +19,7 @@
package appeng.parts;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -103,7 +103,7 @@ public class PartPlacement
if( mop != null )
{
final List<ItemStack> is = new LinkedList<>();
final List<ItemStack> is = new ArrayList<>();
final SelectedPart sp = selectPart( player, host,
mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) );
@@ -19,9 +19,9 @@
package appeng.parts.networking;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.LinkedList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -134,7 +134,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
@Override
public Collection<IEnergyGridProvider> providers()
{
Collection<IEnergyGridProvider> providers = new LinkedList<>();
Collection<IEnergyGridProvider> providers = new ArrayList<>();
try
{
@@ -19,9 +19,10 @@
package appeng.parts.p2p;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -252,7 +253,7 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
if( s == null )
{
DEPTH.set( s = new LinkedList<>() );
DEPTH.set( s = new ArrayDeque<>() );
}
return s;
@@ -260,7 +261,7 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
private List<PartP2PFluids> getOutputs( final Fluid input )
{
final List<PartP2PFluids> outs = new LinkedList<>();
final List<PartP2PFluids> outs = new ArrayList<>();
try
{
@@ -19,7 +19,7 @@
package appeng.parts.p2p;
import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -205,7 +205,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power>
return amount;
}
LinkedList<PartP2PIC2Power> options = new LinkedList<>();
List<PartP2PIC2Power> options = new ArrayList<>();
for( PartP2PIC2Power o : outs )
{
if( o.bufferedEnergy1 <= 0.01 )
@@ -19,9 +19,9 @@
package appeng.parts.p2p;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
@@ -224,7 +224,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
}
}
final LinkedList<PartP2PTunnelME> newSides = new LinkedList<>();
final List<PartP2PTunnelME> newSides = new ArrayList<>();
try
{
for( final PartP2PTunnelME me : this.getOutputs() )
@@ -247,7 +247,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
{
final TileEntity start = this.getTile();
final TileEntity end = me.getTile();
AELog.debug( e );
AELog.warn( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]",
@@ -19,8 +19,8 @@
package appeng.spatial;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
@@ -56,11 +56,11 @@ public class CachedPlane
private final int y_size;
private final Chunk[][] myChunks;
private final Column[][] myColumns;
private final LinkedList<TileEntity> tiles = new LinkedList<>();
private final LinkedList<NextTickListEntry> ticks = new LinkedList<>();
private final List<TileEntity> tiles = new ArrayList<>();
private final List<NextTickListEntry> ticks = new ArrayList<>();
private final World world;
private final IMovableRegistry reg = AEApi.instance().registries().movable();
private final LinkedList<WorldCoord> updates = new LinkedList<>();
private final List<WorldCoord> updates = new ArrayList<>();
private int verticalBits;
private final IBlockState matrixBlockState;
@@ -122,8 +122,8 @@ public class CachedPlane
{
for( int cz = 0; cz < this.cz_size; cz++ )
{
final LinkedList<Entry<BlockPos, TileEntity>> rawTiles = new LinkedList<>();
final LinkedList<BlockPos> deadTiles = new LinkedList<>();
final List<Entry<BlockPos, TileEntity>> rawTiles = new ArrayList<>();
final List<BlockPos> deadTiles = new ArrayList<>();
final Chunk c = w.getChunkFromChunkCoords( minCX + cx, minCZ + cz );
this.myChunks[cx][cz] = c;
@@ -380,7 +380,7 @@ public class CachedPlane
}
}
LinkedList<WorldCoord> getUpdates()
List<WorldCoord> getUpdates()
{
return this.updates;
}
@@ -460,7 +460,7 @@ public class CachedPlane
{
if( this.skipThese == null )
{
this.skipThese = new LinkedList<>();
this.skipThese = new ArrayList<>();
}
this.skipThese.add( yCoord );
}
@@ -188,7 +188,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isClient() )
{
return (boolean) this.world.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED );
return this.world.getBlockState( this.pos ).getValue( BlockCraftingUnit.FORMED );
}
return this.cluster != null;
}
@@ -218,7 +218,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
}
else
{
this.setPreviousState( (NBTTagCompound) data.copy() );
this.setPreviousState( data.copy() );
}
}
}
@@ -343,7 +343,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
{
if( Platform.isClient() )
{
return (boolean) this.world.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED );
return this.world.getBlockState( this.pos ).getValue( BlockCraftingUnit.POWERED );
}
return this.getProxy().isActive();
}
+4 -5
View File
@@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.WeakHashMap;
@@ -1134,7 +1133,7 @@ public class Platform
public static <T extends IAEStack<T>> T poweredExtraction( final IEnergySource energy, final IMEInventory<T> cell, final T request, final IActionSource src )
{
final T possible = cell.extractItems( (T) request.copy(), Actionable.SIMULATE, src );
final T possible = cell.extractItems( request.copy(), Actionable.SIMULATE, src );
long retrieved = 0;
if( possible != null )
@@ -1166,7 +1165,7 @@ public class Platform
public static <T extends IAEStack<T>> T poweredInsert( final IEnergySource energy, final IMEInventory<T> cell, final T input, final IActionSource src )
{
final T possible = cell.injectItems( (T) input.copy(), Actionable.SIMULATE, src );
final T possible = cell.injectItems( input.copy(), Actionable.SIMULATE, src );
long stored = input.getStackSize();
if( possible != null )
@@ -1185,7 +1184,7 @@ public class Platform
if( itemToAdd < input.getStackSize() )
{
final long original = input.getStackSize();
final T split = (T) input.copy();
final T split = input.copy();
split.decStackSize( itemToAdd );
input.setStackSize( itemToAdd );
split.add( cell.injectItems( input, Actionable.MODULATE, src ) );
@@ -1266,7 +1265,7 @@ public class Platform
public static <T extends IAEStack<T>> void postListChanges( final IItemList<T> before, final IItemList<T> after, final IMEMonitorHandlerReceiver<T> meMonitorPassthrough, final IActionSource source )
{
final LinkedList<T> changes = new LinkedList<>();
final List<T> changes = new ArrayList<>();
for( final T is : before )
{
+2 -2
View File
@@ -19,10 +19,10 @@
package appeng.util.item;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.NavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
@@ -90,7 +90,7 @@ public final class ItemList implements IItemList<IAEItemStack>
}
else
{
final Collection<IAEItemStack> output = new LinkedList<>();
final Collection<IAEItemStack> output = new ArrayList<>();
for( final IAEItemStack is : or.getAEEquivalents() )
{
@@ -22,7 +22,6 @@ package appeng.util.item;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -35,7 +34,7 @@ import appeng.api.storage.data.IAEItemStack;
public class OreReference
{
private final List<String> otherOptions = new LinkedList<>();
private final List<String> otherOptions = new ArrayList<>();
private final Set<Integer> ores = new HashSet<>();
private List<IAEItemStack> aeOtherOptions = null;
@@ -19,9 +19,9 @@
package appeng.worldgen;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.block.Block;
@@ -295,7 +295,7 @@ public final class MeteoritePlacer
this.skyStoneDefinition.maybeStack( amount ).ifPresent( ap::addItems );
break;
case 1:
final List<ItemStack> possibles = new LinkedList<>();
final List<ItemStack> possibles = new ArrayList<>();
possibles.addAll( OreDictionary.getOres( "nuggetIron" ) );
possibles.addAll( OreDictionary.getOres( "nuggetCopper" ) );
possibles.addAll( OreDictionary.getOres( "nuggetTin" ) );