Re: Preserve collection order

2003-07-31 Thread Matt Liotta
The below is a basic example. sortedMap = CreateObject("java", "java.util.TreeMap"); sortedMap.put("someKey", "someValue"); sortedMap.put("anotherKey", "anotherValue"); However, you would still need to create a Comparator in Java as well as use the appropriate methods

RE: Preserve collection order

2003-07-31 Thread
Thanks for the feedback all! Matt, you wouldn't happen to have a snippet of CFML code you can send me for this as I've never done this, or used any kind of Java code w/in CF before. If not, no big thing. TIA ~| Archives: http:/

RE: Preserve collection order

2003-07-31 Thread David Collie (itndac)
Ha... wish I had though of that a couple of weeks ago and would have saved myself a rewrite of existing code! Good tip! -Original Message- From: Brad Roberts Sent: 31 July 2003 16:27 To: CF-Talk Subject: RE: Preserve collection order Hard code the list of struct keys... putting it into

Re: Preserve collection order

2003-07-31 Thread Matt Liotta
You will need to use a different data structure. One idea is to make use of java.util.SortedMap (http://java.sun.com/j2se/1.4.1/docs/api/java/util/SortedMap.html), which is very similar to a struct except that the keys are kept in order based on a Comparator passed to the constructor. -Mat

RE: Preserve collection order

2003-07-31 Thread Brad Roberts
Hard code the list of struct keys... putting it into the structure itself might help you remember to update the list when you add a key to the struct. #instance[i].heading# - #instance[i].size# -Brad > -Original Message- > From: Suyer,

RE: Preserve collection order

2003-07-31 Thread Raymond Camden
Sure, use an array. Seriously though - struct keys are not meant to be ordered. If you want it ordered, just use an array of structs. === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of