• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Comparing arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparing arrays


  • Subject: Re: Comparing arrays
  • From: Frederic JECKER <email@hidden>
  • Date: Mon, 11 Jun 2007 16:04:47 +0200

Another way would be to create a custom java.util.Comparator to compare Integer to Long objects to avoid conversion.
Once done, just create two java.util.TreeSet (one for each array) and populate them with the addAll() function.
Then the removeAll() function should do the job


Regards

FJ

Galen Rhodes a écrit :
You could try mass conversion of the arrays to strings like so:

NSArray arStr = NSArray.componentsSeparatedByString(arLong.componentsJoinedByString("|"), "|");

I think that'll work.

--
Galen Rhodes
email@hidden

"There is no worse tyranny than to force a man to pay for what he does not want merely because you think it would be good for him."

-- Robert Heinlein --



On Jun 11, 2007, at 1:34 AM, Michelle Parker wrote:

Hi all

I have a slight problem which I am looking for the most efficient solution:

I am comparing 2 NSArrays containing numbers, with the aim of removing the numbers in one array from the other array.

The first array is obtained by rawRowsForSQL which returns the numbers as Longs.
The second array is obtained by valueForKeyPath which returns the numbers as Integers.


NSArray.removeObjectWithArray or NSSet.subtractSet don't work because the objects are not equal.

The arrays can be very large, ie. 100,000 objects.

What is the best way to handle this?

thanks
mich
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:


This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:


This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Comparing arrays
      • From: Frederic JECKER <email@hidden>
References: 
 >Comparing arrays (From: Michelle Parker <email@hidden>)
 >Re: Comparing arrays (From: Galen Rhodes <email@hidden>)

  • Prev by Date: Re: Comparing arrays
  • Next by Date: Re: Comparing arrays
  • Previous by thread: Re: Comparing arrays
  • Next by thread: Re: Comparing arrays
  • Index(es):
    • Date
    • Thread