Results 1 to 3 of 3
- 10-08-2012, 02:27 AM #1
Member
- Join Date
- Oct 2012
- Posts
- 1
- Rep Power
- 0
how to dynamically populate Hashmaps
hi,
I am reading a xls and want to populate my hashmap with <K,V> where K is the values which I read from xls and V is an integer variable with initial value 1 . if the K already exists then only the vlaue should be incremented and if the vlaue read from the xls is new then a new <K,V> pair should be created with K as the value from xls and V as 1 .
below is the code I am using but encountering following problems-
1) output is unexpected : {10006.0=24, 100020.0=8 , why is there a '=' sign ?
2) either the control does not enter the if condition or the else
whichever ways I am not getting the correct output.
pls help
- 10-08-2012, 03:51 AM #2
Re: how to dynamically populate Hashmaps
Moved from Advanced Java
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 10-08-2012, 03:57 AM #3
Re: how to dynamically populate Hashmaps
Where?
Why is that unexpected? On what are your expectations based?
Sounds like exactly the way I would expect if / else to behave.
And so far, only you know what you consider to be correct.
Sure, once you give us enough to be able to try to help.
To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates your problem. Use hardcoded data, we're not going to create and read a spreadsheet for a problem that so far appears to have its roots in your need to better understand the Map interface.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
hashmaps
By santa in forum New To JavaReplies: 6Last Post: 05-03-2011, 11:07 PM -
Populate an array dynamically
By mmarkym in forum New To JavaReplies: 11Last Post: 12-31-2010, 03:31 PM -
dynamically populate the city combo box based on the values of state combo +ajax+jsp
By sandy1000 in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 12-29-2010, 10:00 AM -
dynamically populate a dropdown box using jsp
By sandy1000 in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 12-27-2010, 02:21 PM -
Concerning HashMaps
By hjensen in forum New To JavaReplies: 7Last Post: 10-18-2010, 03:36 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks