- 0
This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..
Question
Solomun
Lets say i have an ArrayList list = new arraylist<l2pcInstance>. This list has about 1.000.000 l2pcinstance objects.
Do you think this would be a problem?
Lets say i want to create a method somewhere like:
getPlayersByLocation(String location)
{
ArrayList beta = new ArrayList<L2PcInstance>();
for (L2PcInstance pc : list)
{
if (pc.getLocation.equals(location)
beta.add(pc);
}
return beta;
}
Do you think this would cause a problem to servers memory? If this arraylist has about 1m items + i search in all of them frequntly?
I mean, it is better to search all time the database (SELECT from players where location = location)?
8 answers to this question
Recommended Posts