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.
Warning: This guy is a big scammer, trying to sell everything, advertising for servers etc.
That's his mail address evgesha.nrnr@gmail.com , stay away!
@Atom @Celestine
Warning: This guy is a big scammer, trying to sell everything, advertising for servers etc.
That's his mail address evgesha.nrnr@gmail.com , stay away!
@Celestine
@Atom
Question
L2shaken
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 L2shaken17 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now