Used List instead of ArrayList for declarations.

This commit is contained in:
MobiusDevelopment
2020-06-20 18:58:43 +00:00
parent cedd794473
commit 61157a6d03
253 changed files with 819 additions and 624 deletions

View File

@@ -17,6 +17,7 @@
package ai.bosses.Anais;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.Location;
@@ -41,7 +42,7 @@ public class Anais extends AbstractNpcAI
// Skill
private static SkillHolder DIVINE_NOVA = new SkillHolder(6326, 1);
// Instances
ArrayList<Npc> _divineBurners = new ArrayList<>(4);
List<Npc> _divineBurners = new ArrayList<>(4);
private PlayerInstance _nextTarget = null;
private Npc _current = null;
private int _pot = 0;

View File

@@ -261,7 +261,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
protected static Map<Integer, Long> _warDecreesCount = new HashMap<>();
protected static List<Clan> _acceptedClans = new ArrayList<>(4);
private static Map<String, ArrayList<Clan>> _usedTextPassages = new HashMap<>();
private static Map<String, List<Clan>> _usedTextPassages = new HashMap<>();
private static Map<Clan, Integer> _pendingItemToGet = new HashMap<>();
protected static SiegableHall _rainbow;
@@ -545,7 +545,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
if (_usedTextPassages.containsKey(passage))
{
final ArrayList<Clan> list = _usedTextPassages.get(passage);
final List<Clan> list = _usedTextPassages.get(passage);
if (list.contains(clan))
{
html = "yeti_passage_used.htm";

View File

@@ -781,7 +781,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
{
try (Connection con = DatabaseFactory.getConnection())
{
final ArrayList<Integer> listInstance = _data.get(clanId).players;
final List<Integer> listInstance = _data.get(clanId).players;
if (listInstance == null)
{
LOGGER.warning(getName() + ": Tried to load unregistered clan with ID " + clanId);
@@ -880,8 +880,8 @@ public abstract class FlagWar extends ClanHallSiegeEngine
{
int flag = 0;
int npc = 0;
ArrayList<Integer> players = new ArrayList<>(18);
ArrayList<PlayerInstance> playersInstance = new ArrayList<>(18);
List<Integer> players = new ArrayList<>(18);
List<PlayerInstance> playersInstance = new ArrayList<>(18);
Spawn warrior = null;
Spawn flagInstance = null;
}

View File

@@ -21,6 +21,7 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.data.xml.impl.SkillData;
@@ -208,7 +209,7 @@ public class ScarletVanHalisha extends AbstractNpcAI
private Creature getRandomTarget(Npc npc, Skill skill)
{
final ArrayList<Creature> result = new ArrayList<>();
final List<Creature> result = new ArrayList<>();
for (WorldObject obj : World.getInstance().getVisibleObjects(npc, WorldObject.class))
{
if (obj.isPlayable() || (obj instanceof DecoyInstance))

View File

@@ -111,7 +111,7 @@ public class FishData implements IXmlReader
*/
public List<Fish> getFish(int level, int group, int grade)
{
final ArrayList<Fish> result = new ArrayList<>();
final List<Fish> result = new ArrayList<>();
Map<Integer, Fish> fish = null;
switch (grade)
{

View File

@@ -68,7 +68,7 @@ public class SchemeBufferTable
final int objectId = rs.getInt("object_id");
final String schemeName = rs.getString("scheme_name");
final String[] skills = rs.getString("skills").split(",");
final ArrayList<Integer> schemeList = new ArrayList<>();
final List<Integer> schemeList = new ArrayList<>();
for (String skill : skills)
{
// Don't feed the skills list if the list is empty.

View File

@@ -666,7 +666,7 @@ public abstract class DocumentBase
case "clanhall":
{
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
final List<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
final String item = st.nextToken().trim();
@@ -742,7 +742,7 @@ public abstract class DocumentBase
case "class_id_restriction":
{
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
final List<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
final String item = st.nextToken().trim();
@@ -760,7 +760,7 @@ public abstract class DocumentBase
case "instanceid":
{
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
final List<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
final String item = st.nextToken().trim();
@@ -784,7 +784,7 @@ public abstract class DocumentBase
case "haspet":
{
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
final List<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
final String item = st.nextToken().trim();
@@ -796,7 +796,7 @@ public abstract class DocumentBase
case "servitornpcid":
{
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
final List<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
final String item = st.nextToken().trim();

View File

@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.model.clientstrings;
import java.util.ArrayList;
import java.util.List;
/**
* @author Forsaiken, Zoey76
@@ -31,7 +32,7 @@ public abstract class Builder
public static Builder newBuilder(String text)
{
final ArrayList<Builder> builders = new ArrayList<>();
final List<Builder> builders = new ArrayList<>();
int index1 = 0;
int index2 = 0;

View File

@@ -70,7 +70,7 @@ public class ItemAuctionInstance
private final int _instanceId;
private final AtomicInteger _auctionIds;
private final Map<Integer, ItemAuction> _auctions;
private final ArrayList<AuctionItem> _items;
private final List<AuctionItem> _items;
private final AuctionDateGenerator _dateGenerator;
private ItemAuction _currentAuction;
@@ -346,7 +346,7 @@ public class ItemAuctionInstance
public ItemAuction[] getAuctionsByBidder(int bidderObjId)
{
final Collection<ItemAuction> auctions = getAuctions();
final ArrayList<ItemAuction> stack = new ArrayList<>(auctions.size());
final List<ItemAuction> stack = new ArrayList<>(auctions.size());
for (ItemAuction auction : getAuctions())
{
if ((auction.getAuctionState() != ItemAuctionState.CREATED) && (auction.getBidFor(bidderObjId) != null))

View File

@@ -181,7 +181,7 @@ public class MultiSellChoose implements IClientIncomingPacket
return;
}
final ArrayList<Ingredient> ingredientsList = new ArrayList<>(entry.getIngredients().size());
final List<Ingredient> ingredientsList = new ArrayList<>(entry.getIngredients().size());
// Generate a list of distinct ingredients and counts in order to check if the correct item-counts
// are possessed by the player
boolean newIng;

View File

@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.network.loginserverpackets.game;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.network.BaseSendablePacket;
@@ -25,7 +26,7 @@ import org.l2jmobius.commons.network.BaseSendablePacket;
*/
public class ServerStatus extends BaseSendablePacket
{
private final ArrayList<Attribute> _attributes;
private final List<Attribute> _attributes;
public static final String[] STATUS_STRING =
{

View File

@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.List;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.model.WorldObject;
@@ -58,7 +59,7 @@ public class StatusUpdate implements IClientOutgoingPacket
public static final int MAX_CP = 0x22;
private final int _objectId;
private final ArrayList<Attribute> _attributes = new ArrayList<>();
private final List<Attribute> _attributes = new ArrayList<>();
static class Attribute
{

View File

@@ -29,6 +29,7 @@ import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@@ -302,7 +303,7 @@ public class GameServerTable implements IXmlReader
private GameServerThread _gst;
private int _status;
// network
private final ArrayList<GameServerAddress> _addrs = new ArrayList<>(5);
private final List<GameServerAddress> _addrs = new ArrayList<>(5);
private int _port;
// config
private static final boolean IS_PVP = true;