Please note that you can implement toString() on the item class to do
anything you want. But that doesn't imply it's a good way to compare two
collections.

 

Perhaps you should reconsider whether you really need two collections
that may or may not be exactly the same. Or consider keeping a 'dirty'
flag that you set to true when you add, remove, or edit an item.

 

Gordon Smith

Adobe Flex SDK Team

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Sid Maskit
Sent: Thursday, July 17, 2008 4:47 PM
To: [email protected]
Subject: Re: [flexcoders] Re: Comparing two array collections

 

Maybe somebody else will have one, but I am not seeing a simple way to
do this in a more sophisticated manner. This leads me to the following
question: Are you experiencing performance problems? If not, I would
suggest coding what works, and not worrying about the overhead involved
in a somewhat brute force approach. If you start encountering
performance problems, and identify this part of the code as where the
problem lies, then it might be worth putting in the additional work to
develop a more subtle solution.

 

----- Original Message ----
From: tchredeemed <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, July 17, 2008 1:13:48 PM
Subject: [flexcoders] Re: Comparing two array collections

Just an update, I know I can pass both into a function that does the
following:

checkForEquality( a:AC, b:AC ):Boolean {
if( a.length != b.length ) return false;

loop through each item
if an item differs, return false;

return true;
}

however, I was hoping for a solution with less overhead.

--- In [EMAIL PROTECTED] ups.com <mailto:flexcoders%40yahoogroups.com>
, "tchredeemed" <[EMAIL PROTECTED] > wrote:
>
> How would you go about comparing two array collections?
> 
> Each array collection is populated with items of an ADT ("Order", to
> be exact).
> 
> If I do .toString() comparisons, it only appears as different if I add
> or remove an "Order", because the .toString() shows up as "[object
> Order], [object Order], etc.."
> 
> I need to know if I add or remove an order, as well as if an order
> changes...
> 
> Just wondering if there is an easy solution.
>

 

 

Reply via email to