comparing two arrays of integers.

N

Nag

Hi,
I have two arrays of integers. i need to compare each element of one
array with each element of another array.
say..one master list, from 1 to 100 in one array.
and another list, from 20 to 40 in another array.
After comparision of two arrays, it should return a another arraylist
which should contain only 1 to 19 and 41 to 100.

how to do this?
Thanks for your inputs.
 
W

Wibble

Nag said:
Hi,
I have two arrays of integers. i need to compare each element of one
array with each element of another array.
say..one master list, from 1 to 100 in one array.
and another list, from 20 to 40 in another array.
After comparision of two arrays, it should return a another arraylist
which should contain only 1 to 19 and 41 to 100.

how to do this?
Thanks for your inputs.
Isn't school over yet?
 
N

Nag

I should have used some java "techie" terms here...
any how, i got the solution..
I created two sets of data. and used following method:
set1.removeAll(set2)..
removeAll method removes from set1 all of its elements that are
contained in the specified collection (here set2)...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top