java - arraylist sorting -


i have 2 arraylist 1 have employee entity list other have same entity list.

one arraylist have employees , other 1 have selected employees.

now want arrange employee in list in first arraylist on selected employees first arrive in second arraylist.

for ex::

list1 [{1,test1}{2,test2},{3,test3},{4,test4}] list2[{2,test2}{4,test4}] 

what want is

list1[{2,test2}{4,test4}{1,test1}{3,test3}] 

how can same using single method or minimal line code ..

from have said seems need take members of list1 not in list2 , append them list2 in order appear in list1.

something like:

for ( employee e : list1 ) {   if ( !list2.contains(e) ) {     list2.append(e);   } } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -