compare 2 lists
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Lavanaya_Senthil
Posted On:   Monday, September 26, 2005 04:40 AM

How to compare two lists and get a result list with the values common to both list

For example

List1 = [a,b,c,d,e,f]
List2 = [b,d,e,g,h,i,j]

resultList = [b,d,e]

Re: compare 2 lists

Posted By:   Shan_Thiruvarur  
Posted On:   Tuesday, November 22, 2005 03:25 AM

hope the issue is solved ...





regds


vidhyasankar.natarajan@wipro.com

Re: compare 2 lists

Posted By:   srini_vasan  
Posted On:   Wednesday, October 5, 2005 06:02 AM

Hi,


To find common elements from the two list , u can use the following
program.


ArrayList List1,List2,List3;


//----some actions here

for(int i=0;i {

if(List2.contains(List1.get(i)))
{
List3.add(List1.get(i);
}

}


Finally , List3 has objects that common to both List1 and
List2.



thanks,

srini

Re: compare 2 lists

Posted By:   Jani_Kaarela  
Posted On:   Monday, September 26, 2005 06:23 AM

About | Sitemap | Contact