Have I correctly added an element to a hashTable?
Flows flows = new Flows(sIP,dIP);
FlowStatics flowStatics = new FlowStatics(packetLength,timeArrival);
HashMap myHashMap = new HashMap<Flows, FlowStatics>();
myHashMap.put(flows, flowStatics);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To avoid compiler warnings, code it like this:
If you don’t parametrize the myHashMap variable, then you can’t add in the second line without getting warnings.
Here is working example on how to ‘print’ some hashmap statistics:
(OP asked for adivice in a comment to another answer)