5 Replies Latest reply on Dec 13, 2008 7:26 PM by Newsgroup_User

    Without looping: Determine number of unique values in a set

    shawnyale
      Hi all,
      I was wondering if anyone has any advice on determining the number of unique items in a set. For example:

      If I have an ArrayCollection
      public var someData:ArrayCollection = new ArrayCollection([
      {id:"1", color:"Red", value:5"},
      {id:"2", color:"Red", value:"4"},
      {id:"3", color:"Green", value:"17"},
      {id:"4", color:"Red", value:"3"},
      {id:"5", color:"Blue", value:"4"}]);

      What I want returned is just Red, Green, Blue but not Red, Red, Green, Red, Blue. Or even better would just be a number telling me how many unique values are in the set. I've spent hours digging through the asdocs but have not found anything that performs this type of analysis and I've typically had to resort to endless loops (which can affect performance when the data set is large).

      I would appreciate any words of wisdom.