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
@@ -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]",