array comparison and sort
From: vic (vivi74_at_rocketmail.com)
Date: 10/30/04
- Next message: Darryl L. Pierce: "Re: Developing MIDlet for PDAs and cell phones"
- Previous message: Rhino: "Re: Developing MIDlet for PDAs and cell phones"
- Next in thread: Chris Smith: "Re: array comparison and sort"
- Reply: Chris Smith: "Re: array comparison and sort"
- Maybe reply: Sudsy: "Re: array comparison and sort"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Oct 2004 06:41:29 -0700
Hello All,
I am running into this problem of getting my array to output the
desired results. Below is the problem
i have two string arrays via
String[] ar1 = {1,2,1,4,1,2};
String[] ar2 = {7,3,7,5,7,3};
each array contains 6 elements.
i want to do something like this
compare elements of ar1 and ar2 with one another and the moment it
encounters a true condition, e.g in the above example when
(ar1[0].equals(ar1[2])) && (ar2[0].equals(ar2[2]))
then i want to array pointer to move to ar1[1] and ar2[1] so that it
starts comparing from index->1 and same logic apllies. The output
would be something like this for the first iteration
ar1 = {2,1,4,1,2}
ar2 = {3,7,5,7,3}
now if we applied same logic in a loop output would be
ar1 = {1,4,1,2}
ar2 = {7,5,7,3}
and final output
ar1 = {4,1,2}
ar2 = {5,7,3}
The final output should have a unique set of values
Appreciate any help
thanks
vivi
- Next message: Darryl L. Pierce: "Re: Developing MIDlet for PDAs and cell phones"
- Previous message: Rhino: "Re: Developing MIDlet for PDAs and cell phones"
- Next in thread: Chris Smith: "Re: array comparison and sort"
- Reply: Chris Smith: "Re: array comparison and sort"
- Maybe reply: Sudsy: "Re: array comparison and sort"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|