Click here to Skip to main content
15,891,943 members
Home / Discussions / Java
   

Java

 
QuestionProgress Bar Pin
Manish K. Agarwal30-Aug-12 22:16
Manish K. Agarwal30-Aug-12 22:16 
GeneralRe: Progress Bar Pin
Manfred Rudolf Bihy30-Aug-12 22:25
professionalManfred Rudolf Bihy30-Aug-12 22:25 
QuestionLWJGL Texture error Pin
Joshua Waring29-Aug-12 3:12
Joshua Waring29-Aug-12 3:12 
AnswerRe: LWJGL Texture error Pin
Richard MacCutchan29-Aug-12 4:18
mveRichard MacCutchan29-Aug-12 4:18 
AnswerRe: LWJGL Texture error Pin
Wes Aday29-Aug-12 5:24
professionalWes Aday29-Aug-12 5:24 
AnswerRe: LWJGL Texture error Pin
Nagy Vilmos29-Aug-12 5:31
professionalNagy Vilmos29-Aug-12 5:31 
AnswerRe: LWJGL Texture error Pin
Joshua Waring30-Aug-12 1:28
Joshua Waring30-Aug-12 1:28 
Questionjava map question Pin
amvest28-Aug-12 18:13
amvest28-Aug-12 18:13 
The code below returns the least frequent AGE or rarest age in the name/age map below;
{Alyssa=22, Char=25, Dan=25, Jeff=20, Kasey=20, Kim=20, Mogran=25, Ryan=25, Stef=22}

which is stef=22 as it shows up twice where others show up 3 times in the map collection. I cannot understand the code starting at line 11 on. I'd appreciate any help.

public static int rarestAge(Map<string, integer=""> map) {
if (map == null || map.isEmpty()) {
throw new IllegalArgumentException();
}
Map<integer, integer=""> map2 = new TreeMap<integer, integer="">();
for (String name : map.keySet()) {
int age = map.get(name);
if (map2.containsKey(age)) {

map2.put(age, map2.get(age) + 1);
} else {
map2.put(age, 1);
}
}
int count3 = map.size() + 1;
int rarest = -1;
for (int age : map2.keySet()) {
int count = map2.get(age);
// line 11...I cannot understand the code below;
if (count < count3) {
count3 = count;
rarest = age;
}
}
return rarest;
}
AnswerRe: java map question Pin
Bernhard Hiller28-Aug-12 21:56
Bernhard Hiller28-Aug-12 21:56 
GeneralRe: java map question Pin
amvest29-Aug-12 21:39
amvest29-Aug-12 21:39 
Questionhow to done!!!! Pin
gambhire shiva27-Aug-12 1:34
gambhire shiva27-Aug-12 1:34 
AnswerRe: how to done!!!! PinPopular
TorstenH.27-Aug-12 2:13
TorstenH.27-Aug-12 2:13 
GeneralRe: how to done!!!! Pin
pasztorpisti27-Aug-12 11:31
pasztorpisti27-Aug-12 11:31 
GeneralRe: how to done!!!! Pin
Mohibur Rashid16-Sep-12 4:35
professionalMohibur Rashid16-Sep-12 4:35 
AnswerRe: how to done!!!! Pin
Bernhard Hiller27-Aug-12 3:01
Bernhard Hiller27-Aug-12 3:01 
QuestionHow i can send email through web application using java Pin
mayureshdh26-Aug-12 20:04
mayureshdh26-Aug-12 20:04 
AnswerRe: How i can send email through web application using java Pin
TorstenH.26-Aug-12 20:21
TorstenH.26-Aug-12 20:21 
AnswerRe: How i can send email through web application using java Pin
Member 938878928-Aug-12 6:43
Member 938878928-Aug-12 6:43 
SuggestionRe: How i can send email through web application using java Pin
NamBill26-Dec-12 23:55
NamBill26-Dec-12 23:55 
SuggestionTHREADS Pin
Atulthecoder25-Aug-12 10:53
Atulthecoder25-Aug-12 10:53 
GeneralRe: THREADS Pin
pasztorpisti25-Aug-12 11:14
pasztorpisti25-Aug-12 11:14 
GeneralRe: THREADS Pin
Richard MacCutchan25-Aug-12 21:33
mveRichard MacCutchan25-Aug-12 21:33 
QuestionRead Barcode from mobile and show the product type Pin
Sahil Mahajan Mj24-Aug-12 22:47
Sahil Mahajan Mj24-Aug-12 22:47 
AnswerRe: Read Barcode from mobile and show the product type Pin
TorstenH.25-Aug-12 0:58
TorstenH.25-Aug-12 0:58 
GeneralRe: Read Barcode from mobile and show the product type Pin
Sahil Mahajan Mj25-Aug-12 1:17
Sahil Mahajan Mj25-Aug-12 1:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.