Oleg Gunkin wrote:
> Could anyone translate this pseudo code to coldfusion for me please?
>
>
> HashMap map = new HashMap();
>
> map["a"] = 1;
> map["b"] = 2;
>
> for each key in map {
> print '<a href="' + key + '">' + map[key] + '</a>';
> }
Heh... so many ways to do things.
here's a fun one, especially if you needed a real java hashmap versus a
coldfusion structure:
<cfscript>
map = createObject("java","java.util.HashMap").init();
map.put("a",1);
map.put("b",2);
iter = map.keySet().iterator();
while (iter.hasNext()) {
key = iter.next();
value = map.get(key).toString();
writeOutput("key = #key.toString()#, value = #value#<br>");
}
</cfscript>
rick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:231176
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54