Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iterate through Map in ruby [closed]

Tags:

ruby

How do I rewrite this Java statement in Ruby?

for (Map.Entry<byte[], HServerLoad.RegionLoad> entry : serverLoad.getRegionsLoad().entrySet()){
}

Thanks for your help!

like image 471
user390687 Avatar asked Sep 07 '13 18:09

user390687


1 Answers

If you want to iterate a ruby map(hash) with key and values you could write

h.each { |k, v| puts "Key=#{k}, Value=#{v}" }
like image 70
bsd Avatar answered Oct 25 '22 18:10

bsd