Jump to content
  • 0

Hashmap Error


L2shaken

Question

http://imgur.com/a/KJwdY

protected int getVoteWinner()
	{
		int old = 0;
		HashMap<Integer, Integer> temp = new HashMap<>();
		
		for (int vote : votes.values())
		{
			if (!temp.containsKey(vote))
				temp.put(vote, 1);
			else
			{
				old = temp.get(vote);
				old++;
				temp.getEntry(vote).setValue(old);
			}
		}
		
		int max = temp.head().getNext().getValue();
		int result = temp.head().getNext().getKey();
		
		for (Map.Entry<Integer, Integer> entry : temp.entrySet())
		{
			if (entry.getValue() > max)
			{
				max = entry.getValue();
				result = entry.getKey();
			}
		}
		
		votes.clear();
		temp = null;
		return result;
	}

How do I solve this problem? Use aCis 350, replaces FastMap with HashMap and is giving this error.

Edited by L2shaken
Link to comment
Share on other sites

Recommended Posts

  • 0

No more love for javolution :D

 

I, tbh, got no clue what is Javolution in the end (realtime library, that's it), because L2J didn't use more than 5% of the complete library features. They simply replaced here and there few Lists/Maps/StringBuilder which could be simple ArrayList/HashMap for 70% of them, and for leftover be handled by concurrent (which has been reworked and got decent performance overall). And I personally prefer to rely on JDK features only.

 

In this topic, a concurrent or whatever linked type list is pointless, it can be achieved with better performance with simple container. There is no need to hit the head of the map, it's a result based method, so you begin at 0.

 

I was the first to drop Javolution, so it's more appropriate to say : I never liked it. :P

 

Trove had a better impact than Javolution for sure, notably because we use A LOT of Integer containers. But I tbh find it a pain in the ass to remember you have that library, not even 50% of Integer containers were managed by that lib, so you got inconsistent writting style over the whole pack => drop.

Edited by Tryskell
Link to comment
Share on other sites

  • 0

I don't understand what you want, but this looks like better:

	protected int getVoteWinner()
	{
		final HashMap<Integer, Integer> temp = new HashMap<>();
		for (int vote : votes.values())
		{
			if (!temp.containsKey(vote))
				temp.put(vote, 1);
			
			int old = temp.get(vote);
			temp.getEntry(vote).setValue(++old);
		}
		
		int max = 0;
		int result = 0;
		
		for (Map.Entry<Integer, Integer> entry : temp.entrySet())
		{
			if (entry.getValue() > max)
			{
				max = entry.getValue();
				result = entry.getKey();
			}
		}
		
		return result;
	}
Edited by Rootware
Link to comment
Share on other sites

  • 0

Because your knowledge so sucks. You try to calling from a map the value as object, not like the variable.

	protected int getVoteWinner()
	{
		final HashMap<Integer, Integer> temp = new HashMap<>();
		for (int vote : votes.values())
		{
			if (!temp.containsKey(vote))
				temp.put(vote, 1);
			
			int old = temp.get(vote);
			temp.put(vote, ++old); // If a record with this "vode" exists in Map then she will be rewrited with new value from "old" variable.
		}
		
		int max = 0;
		int result = 0;
		
		for (Map.Entry<Integer, Integer> entry : temp.entrySet())
		{
			if (entry.getValue() > max)
			{
				max = entry.getValue();
				result = entry.getKey();
			}
		}
		
		return result;
	}
Link to comment
Share on other sites

  • 0

http://imgur.com/a/koUCR

Yes, but I still have this photo error.

I'm sorry i know i'm offtopic, why you even bother open a server? I guess you got a free pack since you are do it on your own, your knowledge is 0 and you go for a live server.

 

SweeTs please post a gif for me.

Link to comment
Share on other sites

  • 0

I'm sorry i know i'm offtopic, why you even bother open a server? I guess you got a free pack since you are do it on your own, your knowledge is 0 and you go for a live server.

 

SweeTs please post a gif for me.

no gif for u 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • SELL  Lucera Classic license  80$ or 90 usdt re-binding through the developer dizer. write only in telegram https://t.me/AlB911
    • Nexaslim Weight Loss Supplement Reviews (2024) – Experience the transformative power of Beta-hydroxybutyrate (BHB), a potent fat-burning ketone meticulously crafted to ignite natural weight loss. As the primary substrate that initiates ketosis, BHB swiftly propels your metabolism into action. Upon commencing your regimen, BHB promptly facilitates the transition into ketosis, fostering heightened energy levels and weight reduction advantages. NexaSlim groundbreaking formulation harnesses the unparalleled potential of this singular BHB, prompting a wave of excitement in the media. Benefits of Nexaslim Ketosis:   ·         Lose Weight ·         Burn Fat in Trouble Areas ·         Get into Ketosis Fast! ·         Burn Fat for Energy (without the jitters)! ·         Better Brain Health! ·         Faster Recovery from Exercise! ·         Maintain Lean Muscle! Ready to transform your body? Click here to buy your NexaSlim Weight Loss Pills! now!   The enduring presence of NexaSlim with BHB is a testament to its remarkable achievements, as individuals continue to experience unparalleled success, shedding up to 1 kg of fat daily! Nexa Slim is designed with a comprehensive approach to support your journey toward wellness. It aims to complement the body's natural process of energy utilization, focusing on supporting the metabolic state known as ketosis, where the body can use fat as an energy source. Nexaslim, Nexa Slim Reviews, Nexaslim Weight Loss Ingredients, Benefits, Works, Side Effects, Price & Buy from the Official Website   https://supplementrange.com/nexaslim-norway/   https://supplementrange.com/nexaslim-reviews/   https://supplementrange.com/lepticell-reviews/   https://supplementrange.com/nexalyn-male-enhancement/   https://supplementrange.com/cerebrozen-reviews/   https://supplementrange.com/sugar-defender/   https://supplementrange.com/
    • LGBTQ!! ⋐⋑ (209) 876-5519 Love Spells In Atlanta, GA Psychic Reading Black Magic Spells Marriage spells Divorce spells Psychic Readings | Astrology | Love Spells | Black Magic spells | Witchcraft Spells | Spell Caster | Voodoo spells | Marriage spells | Divorce spells | Attraction spells | Bring back lost lover spells REUNITE WITH AN EX LOVER IN 72 HOURS If your lover is gone, don’t be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will our spiritual powers to bring him/her back Let us show you our method with zero chances of rejection. Don’t waste your precious time; get your lover back NOW! MAKE HIM/HER LOVE ME Don’t wait for the deluge and make him or her love you now. This service will create a great alchemy between this person and you. In just a few weeks, you can make the person you dream of falling in love with you. We recommend you to combine this service with a Marriage ritual if you want this person to commit you. BREAK UP A RELATIONSHIP The perfect service to break up a relationship you don’t think legitimate. Your lover has gone with someone else Don’t hesitate to break them up as this ritual and prayer is very powerful and will Psychic Readings | Astrology | Love Spells | Black Magic spells | Witchcraft Spells | Spell Caster | Voodoo spells | Marriage spells | Divorce spells | Attraction spells | Bring back lost lover spells REUNITE WITH AN EX LOVER IN 72 HOURS If your lover is gone, don’t be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will our spiritual powers to bring him/her back Let us show you our method with zero chances of rejection. Don’t waste your precious time; get your lover back NOW! MAKE HIM/HER LOVE ME Don’t wait for the deluge and make him or her love you now. This service will create a great alchemy between this person and you. In just a few weeks, you can make the person you dream of falling in love with you. We recommend you to combine this service with a Marriage ritual if you want this person to commit you.
    • Psychic Readings | Astrology | Love Spells | Black Magic spells | Witchcraft Spells | Spell Caster | Voodoo spells | Marriage spells | Divorce spells | Attraction spells | Bring back lost lover spells REUNITE WITH AN EX LOVER IN 72 HOURS If your lover is gone, don’t be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will our spiritual powers to bring him/her back Let us show you our method with zero chances of rejection. Don’t waste your precious time; get your lover back NOW! MAKE HIM/HER LOVE ME Don’t wait for the deluge and make him or her love you now. This service will create a great alchemy between this person and you. In just a few weeks, you can make the person you dream of falling in love with you. We recommend you to combine this service with a Marriage ritual if you want this person to commit you. BREAK UP A RELATIONSHIP The perfect service to break up a relationship you don’t think legitimate. Your lover has gone with someone else Don’t hesitate to break them up as this ritual and prayer is very powerful and will Psychic Readings | Astrology | Love Spells | Black Magic spells | Witchcraft Spells | Spell Caster | Voodoo spells | Marriage spells | Divorce spells | Attraction spells | Bring back lost lover spells REUNITE WITH AN EX LOVER IN 72 HOURS If your lover is gone, don’t be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will our spiritual powers to bring him/her back Let us show you our method with zero chances of rejection. Don’t waste your precious time; get your lover back NOW! MAKE HIM/HER LOVE ME Don’t wait for the deluge and make him or her love you now. This service will create a great alchemy between this person and you. In just a few weeks, you can make the person you dream of falling in love with you. We recommend you to combine this service with a Marriage ritual if you want this person to commit you.
    • Psychic Readings | Astrology | Love Spells | Black Magic spells | Witchcraft Spells | Spell Caster | Voodoo spells | Marriage spells | Divorce spells | Attraction spells | Bring back lost lover spells REUNITE WITH AN EX LOVER IN 72 HOURS If your lover is gone, don’t be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will our spiritual powers to bring him/her back Let us show you our method with zero chances of rejection. Don’t waste your precious time; get your lover back NOW! MAKE HIM/HER LOVE ME Don’t wait for the deluge and make him or her love you now. This service will create a great alchemy between this person and you. In just a few weeks, you can make the person you dream of falling in love with you. We recommend you to combine this service with a Marriage ritual if you want this person to commit you. BREAK UP A RELATIONSHIP The perfect service to break up a relationship you don’t think legitimate. Your lover has gone with someone else Don’t hesitate to break them up as this ritual and prayer is very powerful and will Psychic Readings | Astrology | Love Spells | Black Magic spells | Witchcraft Spells | Spell Caster | Voodoo spells | Marriage spells | Divorce spells | Attraction spells | Bring back lost lover spells REUNITE WITH AN EX LOVER IN 72 HOURS If your lover is gone, don’t be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will our spiritual powers to bring him/her back Let us show you our method with zero chances of rejection. Don’t waste your precious time; get your lover back NOW! MAKE HIM/HER LOVE ME Don’t wait for the deluge and make him or her love you now. This service will create a great alchemy between this person and you. In just a few weeks, you can make the person you dream of falling in love with you. We recommend you to combine this service with a Marriage ritual if you want this person to commit you.
  • Topics

×
×
  • Create New...