Traditionally, there is no guarantee for the sorting order of keys in a map.

There are sorted map implementations around though if you are in need of
this functionality (I'm not sure if there is a Clojure sorted map, but the
algorithm is out there).

On Thu, Aug 27, 2009 at 12:35 PM, Howard Lewis Ship <hls...@gmail.com>wrote:

>
> Is the order of keys in a map predictable?  I have some tests I'm
> concerned about, where the keys and values in a map are converted to a
> string (ultimately, a URL, as query parameters) and the order will
> affect the output string.
>
> I could sort the keys, but then I'm changing my code to support the
> test in a somewhat non-trivial way.
>
> Literally: when iterating over the key/value pairs, the order seems to
> be the order in which the key/values are defined in the map. Is this
> true?
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to