• Post Reply Bookmark Topic Watch Topic
  • New Topic

Iterate and Update LinkedHashMap<String, String[]>  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i have to itereate data in LinkedHashMap<String, String[]> distinctDate = new LinkedHashMap <String, String[]>();
Key Value[0] Value[1]
"wk 24 15" 2015-06-13 0
"wk 25 15" 2015-06-20 0
"wk 26 15" 2015-06-27 0
"wk 27 15" 2015-07-04 0
"wk 28 15" 2015-07-11 0
"wk 29 15" 2015-07-18 0
"wk 30 15" 2015-07-25 0
"wk 31 15" 2015-08-01 0
"wk 32 15" 2015-08-08 0
"wk 33 15" 2015-08-15 0
"wk 34 15" 2015-08-22 0
"wk 35 15" 2015-08-29 0
"wk 36 15" 2015-09-05 0
"wk 37 15" 2015-09-12 0
"wk 38 15" 2015-09-19 0

and update value[1] from int[] fourFourFive = {2,4,5}; as

"wk 24 15" 2015-06-13 2
"wk 25 15" 2015-06-20 2
"wk 26 15" 2015-06-27 4
"wk 27 15" 2015-07-04 4
"wk 28 15" 2015-07-11 4
"wk 29 15" 2015-07-18 4
"wk 30 15" 2015-07-25 5
"wk 31 15" 2015-08-01 5
"wk 32 15" 2015-08-08 5
"wk 33 15" 2015-08-15 5
"wk 34 15" 2015-08-22 5
"wk 35 15" 2015-08-29 2
"wk 36 15" 2015-09-05 2
"wk 37 15" 2015-09-12 4
"wk 38 15" 2015-09-19 4

and so on.

Pleas help

 
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Snake mh wrote:i have to itereate data in LinkedHashMap<String, String[]> distinctDate = new LinkedHashMap <String, String[]>();
Key Value[0] Value[1]
"wk 24 15" 2015-06-13 0

OK, first bit of confusion:   It looks to me as though
Key = "wk 24 15"
Value[0] = "2015-06-13"
Value[1] = "0"
in that first line.

Is that correct?

and update value[1] from int[] fourFourFive = {2,4,5}; as

I have absolutely no idea what that means. What is 'fourFourFive', and why is it an int[]?

My suggestion: Show us the relevant bits of your code, and tell us in English, not in Java-speak, what you're trying to do.

Winston
 
Snake mh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes the linkedhashedmap contains data in this format
Key = "wk 24 15"
Value[0] = "2015-06-13"
Value[1] = "0"

what i want to do is update value[1] from linkedhashedmap with the contains of array.
if array contains two element say {2,3} then i want first 2 keys Value[1] to be updated by 2 and next 3 keys Value[1] to be updated by 3 and so on.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Snake mh wrote:what i want to do is update value[1] from linkedhashedmap with the contains of array.
if array contains two element say {2,3} then i want first 2 keys Value[1] to be updated by 2 and next 3 keys Value[1] to be updated by 3 and so on.

OK, well why don't you show us what you've tried. I'm afraid we don't simply hand out "solutions" here, but we're happy to help you find your own.

Winston
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!