Jump to content
  • 0

Fastlist Inside Array (Suggestion - Help)


Question

Posted

Hello i made a small event but i made it using FastList and 1 array and it add 2 objects

and it currently no works so i wanted someone add me on skype

and just see the code and suggest me how should i change it.

Thanks!

 

Skype: unst0ppabl32

Recommended Posts

  • 0
Posted (edited)

On a Map, since Java8 you can use putIfAbsent. On a List you still have to check via .contains if an object isn't already registered. If your List contains 2 elements, it means you add twice the element, or you missed the check.

 

FastList got no uses (should be renamed FatList), use either ArrayList or its concurrent version (only if you add/remove in same time, or if you remove iterating it), CopyOnWriteArray.

 

Otherwise, c/p the part of code.

Edited by Tryskell
  • 0
Posted

On a Map, since Java8 you can use putIfAbsent. On a List you still have to check via .contains if an object isn't already registered. If your List contains 2 elements, it means you add twice the element, or you missed the check.

 

FastList got no uses (should be renamed FatList), use either ArrayList or its concurrent version (only if you add/remove in same time, or if you remove iterating it), CopyOnWriteArray.

 

Otherwise, c/p the part of code.

Ill send u the part of code i made cause i dont want share it and i work in java 7 (freya) so take a look in it (i send it now)thanks

  • 0
Posted

I read your code, and I don't find the use of those arrays and lists. Plus, don't use FastList, use CopyOnWriteArrayList.

 

Eventually ask exactly what you want to do, because even on your PM, with your piece of code, it wasn't clear.

 

For the biggest I think I answered correctly, at least it's the easiest/fastest implementation of your idea.

 

You only have to for loop couples to get needed infos.

  • 0
Posted

I read your code, and I don't find the use of those arrays and lists. Plus, don't use FastList, use CopyOnWriteArrayList.

 

Eventually ask exactly what you want to do, because even on your PM, with your piece of code, it wasn't clear.

 

For the biggest I think I answered correctly, at least it's the easiest/fastest implementation of your idea.

 

You only have to for loop couples to get needed infos.

I made an npc instance that when a player click "register" a window pop up to his/her parther (if partner exist and is in range of 500 aoe )

and ask if she/he want to join  if she accept (join) the couple (those 2 players) are added in the event. 

 

A threadpool start and check 5 min if couples > 4  event start... i want do a couple war 

  • 0
Posted

I made an npc instance that when a player click "register" a window pop up to his/her parther (if partner exist and is in range of 500 aoe )

and ask if she/he want to join  if she accept (join) the couple (those 2 players) are added in the event. 

 

A threadpool start and check 5 min if couples > 4  event start... i want do a couple war 

Pretty basic stuff. Don't use the hard way. Take an example from TvT event.

  • 0
Posted

Pretty basic stuff. Don't use the hard way. Take an example from TvT event.

Yeap yeap i know i already coded many events that use 1 object per time but this time is different.. we speak for 2 object rights?

 

L2PcInstance player = null; (1 object)

L2PcInstance partner = L2World.getInstance().getPlayer(player.getPartnerId());

 

_players.add(player);

_players.add(partner);

 

it works but i also want to make a 2nd map that add

those _players into a new  _playerList map

 

and after add them  _players.clear();  so its fresh clean again...

 

the problem i face is i dont know how to handle _playerList map...  there is nothing i can use   exept a For to teleport them but inside the event

there is nothing to control them like    coupleId(1).doDie  and kill both players if 1 of them die... 

  • 0
Posted

Heeee don't use CopyOnWriteArrayList use a Set from ConcurrentHashMap

  • 0
Posted
final L2PcInstance partner = L2World.getInstance().getPlayer(Couple.getPartnerId(player.getObjectId()));

That's to retrieve the partner, to send your popup (you could simply check wedding manager).

 

Regarding couple management, once again, the easiest is to put booleans flags into Couple class (or an Enum).

 

You for loop couples and retrieve couples with good enum value or good flag value.

 

You got all needed in CoupleManager (getCouples(), getCouple(coupleid), etc).

  • 0
Posted (edited)

Got some tests or infos about it ?

 

No.

 

But basically the javadoc says it all.

 

You got either CopyOnWriteArrayList, which that said :

 

 

 

A thread-safe variant of ArrayList in which all mutative operations (add, set, and so on) are implemented by making a fresh copy of the underlying array.

This is ordinarily too costly.

 

Or a concurrent Set, backed by a ConcurrentHashMap, with all Set properties such as uniqueness. It all depends if he needs to get or not.

Edited by Sdw
  • 0
Posted (edited)

Ooooookkkkk, I was wondering why L2J did that way, and since I ran one little test I understand :P. My code isn't serious and barely be called a test : 100k integers addition, then I Iterator to force concurrency and remove multiples of 2 and 5 (a simple hashset throws a concurrentexception).

 

The only thing which changes from one test to another is the container :

final Set<Integer> map = new CopyOnWriteArraySet<>();
final List<Integer> map = new CopyOnWriteArrayList<>();
final Set<Integer> map = ConcurrentHashMap.newKeySet();

Result is kinda sad :

 

CopyOnWriteArraySet : between 40 and 67sec.

CopyOnWriteArrayList : between 15 and 30sec.

ConcurrentHashMap.newKeySet : between 0,8 and 1,5sec.

 

Don't use CopyOnWriteArrayList nor CopyOnWriteArraySet.

 

I have some commits to do on aCis :P.

 

If you want to test it :

    public static void main(String[] args)
    {
    	 long storedTime = System.currentTimeMillis();
    	 
    	final Set<Integer> map = new CopyOnWriteArraySet<>();
    	
    	//Populate the map.
    	 for (int i = 0 ; i < 100000 ; i++)
    		 map.add(i);
    	 
    	 Iterator<Integer> it = map.iterator();
    	         while(it.hasNext()){
    	        	 Integer value = it.next();
    	             if(value%5 == 0 || value%2 == 0) {
    	            	 System.out.println("skipped:"+value);
    	            	 map.remove(value);
    	             }
    	         }
    	 
    	 long currentTime = System.currentTimeMillis();
    	 System.out.println("map size: " + map.size());
         System.out.println("execution time: " + (currentTime - storedTime));
    }
Edited by Tryskell
  • 0
Posted

 Tryskell the send message window works..  i just dont know how to add 2 objects in 1 array and take them as 1 team

2 players (team1)

2 players (team2)

2 players (team3)

this is what i want to do

and before event start if 1 player click "unregister" it unregister his partner too

  • 0
Posted

public static ArrayList<FastList> couplesList = new ArrayList<>();

public static final FastList<L2PcInstance> _players = new FastList<L2PcInstance>();final L2PcInstance partner = L2World.getInstance().getPlayer(player.getPartnerId());

 

 

 

 

 

 

 


else if (command.startsWith("remove"))

{

 

//=================================================================


if (couplesList.contains(_players))

{

couplesList.remove(_players);

 

player.sendMessage("You removed your participation from event");

partner.sendMessage("Your partner removed the participation from event");

 

setCouples(getCouples() -1);

}

 


 

else if (command.startsWith("join"))

{

 

//=================================================================

 

final L2PcInstance partner = L2World.getInstance().getPlayer(player.getPartnerId());

 

 

_players.add(player);

_players.add(partner);

 

couplesList.add(_players);

 

_players.clear();

 

player.sendMessage("You are registered in the event with your partner");

partner.sendMessage("You are registered in the event with your partner");

 

setCouples(getCouples() + 1);

 

Timer();

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • There was a time when SMS and MMS actually meant something. 📱 You’d hear that message tone, your heart would skip a beat — who texted? what did they say? Every “Hey :)” mattered, because every SMS cost money, and an MMS? That was pure luxury.     Now it’s simpler — no waiting, no saving characters, no wondering if it’ll deliver. You just go to VibeSMS.net — pick a country, choose a number, and get your code in seconds. ⚡     Back then we cherished every message. Now we just make sure everything gets delivered.   🌐 Website: vibe-sms.com 📢 Telegram Channel: https://t.me/vibe_sms
    • I fixed it now my friends can join too, with what do you want help with? Also can you upload the interlude client of gx-ext for c4? just to have it because i deleted the rar i just have the folder
    • me ayudas a montar ese pack por que no entiendo tanto es para tener de prueba
    • GX-C4 pack, its ok...just used it.
    • This post originally appeared on MmoGah. Arena Breakout: Infinite is a hardcore tactical extraction shooter that demands precision, patience, and strategy. This guide will walk you through everything a beginner needs to know—from gear and combat to survival and extraction.     What Is Arena Breakout: Infinite? Arena Breakout: Infinite (ABI) is a free-to-play online extraction shooter developed by MoreFun Studios and released on Steam in September 2025. Unlike traditional battle royales, ABI focuses on risk vs. reward rather than being the last one standing. Players enter instanced maps called "raids," where they must scavenge loot, survive enemy encounters, and extract safely.   Core Gameplay Mechanics 1. Raids and Extraction Each raid features 4–6 teams (solo or squad) dropped into a map. The goal is to loot valuable items and extract through designated points. Extraction is not exclusive—multiple teams can leave the map alive. 2. PvPvE Combat You'll face both human players and AI enemies. AI can be unpredictable and deadly, especially in high-tier zones. 3. No Hand-Holding ABI offers no tutorials or guidance. You learn by dying—and surviving.   Gear and Loadouts 1. Choose Wisely Your gear determines your survivability. Armor, helmets, and medical supplies are essential. Weapons vary in recoil, damage, and handling. Start with low-cost rifles like the AKS-74U or MP5. 2. Insurance System You can insure gear to recover it if you die and it isn't looted. Use insurance for expensive items, but don't rely on it blindly. 3. Backpacks and Storage Larger backpacks allow more loot but make you a bigger target. Organize your inventory to quickly access meds and ammo during combat.   Tactical Tips for Beginners 1. Know What to Loot Prioritize high-value items like weapon parts, medical kits, and rare electronics. Learn loot hotspots on each map—warehouses, bunkers, and military zones often yield better gear. 2. Sound Is Everything Footsteps, gunfire, and reloads are loud. Use headphones and move cautiously. Crouch-walking and slow peeking reduce noise and improve stealth. 3. Map Knowledge Study maps offline or in low-risk raids. Learn extraction points, choke zones, and sniper nests. 4. Stamina Management Sprinting drains stamina, which affects aim and movement. Rest in safe zones and avoid overexertion during firefights.   Combat and Survival 1. Engage Smartly Don't chase kills—survival and extraction are the real goals. Use cover, lean mechanics, and suppressive fire to control fights. 2. Healing and Damage ABI features a detailed health system: limbs can be fractured, bleeding, or disabled. Carry splints, bandages, and painkillers. Know how to treat each condition. 3. Death Is a Lesson You will die—a lot. Use each death to learn positioning, gear value, and enemy behavior.   Progression and Economy 1. Free-to-Play Friendly ABI is generous with starter gear and daily rewards. You can earn the currency Arena Breakout: Infinite Koens through successful raids and selling loot. 2. Marketplace Trade gear with other players or sell to vendors. Prices fluctuate—learn market trends to maximize profit. 3. No Skill Trees Unlike similar games, ABI doesn't use operator skills. Progression is gear-based and tactical, not RPG-style.   Settings and Optimization 1. Graphics and Performance Lower shadows and post-processing for better visibility. Use high FPS settings for smoother combat. 2. Keybinds Customize controls for quick access to healing, leaning, and inventory. Practice muscle memory in offline raids. 3. Audio Settings Maximize footstep and gunfire volume. Reduce ambient noise to focus on threats.   Beginner Loadout Recommendation Slot Item Notes Primary Gun AKS-74U or MP5 Low recoil, easy to handle Secondary Pistol (optional) Backup for emergencies Armor Basic Vest Better than nothing Helmet Light Helmet Protects against headshots Backpack Medium Balance between space and size Meds Bandages, Splints Treat bleeding and fractures Ammo 2–3 extra mags Always reload before fights         Final Advice for New Players Start slow: Don't rush into high-tier zones. Learn the basics in low-risk areas. Play with friends: Squad play improves survival and makes learning easier. Watch and learn: Study streamers and guides to understand advanced tactics. Don't hoard: Use your gear. Hoarding leads to stagnation and fear of loss. Extract often: Surviving and extracting builds confidence and resources. Arena Breakout: Infinite is brutal, but deeply rewarding. With patience and practice, you'll evolve from a terrified scavenger to a confident operator. Every raid is a story—make yours one of survival and triumph.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock