On 19/11/13 11:29, Colin Yates wrote:
In Java I would do something like:

// create a convenient look up to avoid nasty N^2 lookups
Map<Object, Object> keyToValue = new HashMap....
for (Map<Object, Object> kvMap: kvSequence)
  keyToValue.put(kvMap.get("key"), kvMap.put("value"));

List<Object> allKeys = calculateAllKeys();

List<Map<Object, Object>> results = new Array....
for (Object key: allKeys)
  Object result  = keyToValue.get(key); // null is fine for missing keys
  results.put(key, result);

return results;


this code doesn't do any sorting of keys so I'm not sure it would give you the exact desired result you posted...

Jim

--
--
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
--- You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to