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
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:/
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
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
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,
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
6 matches
Mail list logo