Page 1 of 1

Little curiosity about getAllPlayersArray() and similars

Posted: Tue Nov 15, 2011 5:01 pm
by Ekkuzu
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision 8406:
L2JDP Revision 4952:

Ok, I've been aplying some changes on my local project, and I've saw a thing that I don't understood at all when changing some foreach loops from L2World instance. (.getAllPlayers().values() if I'm correct, to put an example)

Code: Select all

for (L2PcInstance cha : L2World.getInstance().getAllPlayersArray())
and

Code: Select all

private void disconnectAllCharacters(){    L2World.getInstance().getAllPlayers().safeForEachValue(new disconnectAllCharacters());}
Where "new disconnectAllCharacters()" it's a class who implements TObjectProcedure and has the old loop body.

The point is: why some have the first manner and some the second? Maybe that private class that implements TObjectProcedure is faster or what? I know less lines do not means always haste, but IMO it's make things more complex, using a separate method + class rather than a simple array.

Thanks and let's see if someone knows why. Cheers.

Re: Little curiosity about getAllPlayersArray() and similars

Posted: Wed Nov 16, 2011 12:49 am
by tukune
readLock/writeLock