Replace ArrayList type fields with List

This commit is contained in:
Brady 2018-08-25 18:35:41 -05:00
parent 32a0f4eaac
commit 72c2a58ef2
No known key found for this signature in database
GPG Key ID: 73A788379A197567
4 changed files with 4 additions and 4 deletions

View File

@ -310,7 +310,7 @@ public class Settings {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T> List<Setting<T>> getByValueType(Class<T> klass) { public <T> List<Setting<T>> getByValueType(Class<T> klass) {
ArrayList<Setting<T>> result = new ArrayList<>(); List<Setting<T>> result = new ArrayList<>();
for (Setting<?> setting : allSettings) { for (Setting<?> setting : allSettings) {
if (setting.klass.equals(klass)) { if (setting.klass.equals(klass)) {
result.add((Setting<T>) setting); result.add((Setting<T>) setting);

View File

@ -235,7 +235,7 @@ public final class CachedRegion implements IBlockTypeAccess {
short numSpecialBlockTypes = in.readShort(); short numSpecialBlockTypes = in.readShort();
for (int i = 0; i < numSpecialBlockTypes; i++) { for (int i = 0; i < numSpecialBlockTypes; i++) {
String blockName = in.readUTF(); String blockName = in.readUTF();
ArrayList<BlockPos> locs = new ArrayList<>(); List<BlockPos> locs = new ArrayList<>();
location[x][z].put(blockName, locs); location[x][z].put(blockName, locs);
short numLocations = in.readShort(); short numLocations = in.readShort();
for (int j = 0; j < numLocations; j++) { for (int j = 0; j < numLocations; j++) {

View File

@ -145,7 +145,7 @@ public class MovementDiagonal extends Movement {
if (toBreakCached != null) { if (toBreakCached != null) {
return toBreakCached; return toBreakCached;
} }
ArrayList<BlockPos> result = new ArrayList<>(); List<BlockPos> result = new ArrayList<>();
for (int i = 4; i < 6; i++) { for (int i = 4; i < 6; i++) {
if (!MovementHelper.canWalkThrough(positionsToBreak[i])) { if (!MovementHelper.canWalkThrough(positionsToBreak[i])) {
result.add(positionsToBreak[i]); result.add(positionsToBreak[i]);

View File

@ -272,7 +272,7 @@ public class ExampleBaritoneControl extends Behavior {
} }
if (msg.toLowerCase().equals("costs")) { if (msg.toLowerCase().equals("costs")) {
Movement[] movements = AStarPathFinder.getConnectedPositions(new BetterBlockPos(playerFeet()), new CalculationContext()); Movement[] movements = AStarPathFinder.getConnectedPositions(new BetterBlockPos(playerFeet()), new CalculationContext());
ArrayList<Movement> moves = new ArrayList<>(Arrays.asList(movements)); List<Movement> moves = new ArrayList<>(Arrays.asList(movements));
moves.sort(Comparator.comparingDouble(movement -> movement.getCost(new CalculationContext()))); moves.sort(Comparator.comparingDouble(movement -> movement.getCost(new CalculationContext())));
for (Movement move : moves) { for (Movement move : moves) {
String[] parts = move.getClass().toString().split("\\."); String[] parts = move.getClass().toString().split("\\.");