Thanks Barney!

----- Original Message ----- 
From: "Barney Boisvert" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, August 13, 2003 8:51 PM
Subject: RE: Return distinct from list


> You can use a struct:
>
> <cfset s = structNew() />
> <cfloop list="#list#" index="i">
>   <cfset structInsert(s, i, "", true) />
> </cfloop>
> <cfset list = structKeyList(s) />
>
> For larger lists, it's probably better to move the list to an array first
> (using listToArray()) because the loop will run faster.
>
> If you know some Java, and have a very large list and/or need the
> performance, you can make use of a java.util.HashSet (any java.util.Set
will
> work, but the HashSet should be the fastest).  The algorithm is the same,
> just different syntax to use the Java object rather than the CF struct.
>
> barneyb
>
> ---
> Barney Boisvert, Senior Development Engineer
> AudienceCentral
> [EMAIL PROTECTED]
> voice : 360.756.8080 x12
> fax   : 360.647.5351
>
> www.audiencecentral.com
>
>
> > -----Original Message-----
> > From: Bryan F. Hogan [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, August 13, 2003 5:40 PM
> > To: CF-Talk
> > Subject: Return distinct from list
> >
> >
> > Anyone know of a way to return the distinct elements from a list?
> >
> > Example:
> > List=1,2,3,2,4,5
> >
> > I want the extra 2 removed with a return of 1,2,3,4,5
> >
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to