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
+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;