Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Hash#keys, Hash#values order question

Reply
Thread Tools

Hash#keys, Hash#values order question

 
 
Ronald Fischer
Guest
Posts: n/a
 
      08-23-2007
Let h be a Hash. Calculating the arrays

k=3Dh.keys
v=3Dh.values

under the assumption that h is not modified
in between, is it guaranteed that for all
indices n

h[k[n]]=3D=3Dv[n]

i.e. that Hash#values delivers the values
in the same order than Hash#keys delivers
the respective keys?

When playing around, I found this always
the case, but can I rely on it?

Ronald
--=20
Ronald Fischer <(E-Mail Removed)>
Phone: +49-89-452133-162

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If you get an order # does it mean the order is accepted? =?Utf-8?B?U3RldmUxMDc3?= Windows 64bit 3 05-12-2005 11:46 PM
Traversion order cf. output order in XSL Soren Kuula XML 2 02-01-2004 09:10 AM
In which order are files looked for when loaded/requierd - and what'sthe order of suffixes? Stephan Kämper Ruby 2 01-18-2004 02:07 PM
postback question, is the order in which objects are rendered and returned controllable? e ASP .Net 1 11-19-2003 10:13 PM
How to Display DropDownList with preserved order (custom order) cspoh ASP .Net Web Controls 0 07-31-2003 09:19 AM



Advertisments