Unique List?

I need a data structure thats like an Array, except it only holds unique entries.

For example:


var a:Sprite = new Sprite();
var b:Sprite = new Sprite();

pushUnique(a);
pushUnique(b);
pushUnique(a);


Now the list should contain only 2 items (not 3!).

I can easily implement pushUnique() like this:


function pushUnique(o:Object):void {
var isIn:Boolean = false;
for (i=0; i<theList.length; i++) {
if (theList* == o)
  isIn = true;
}
if (!isIn)
 theList.push(o);

However, I think this will be very slow once the list gets big, and I’m wondering if there is a smarter way to do this, or if there is already a built in datastructure that does it…