I’m working on a project and I didn’t get this part:
use two threads to sort an ArrayList. each thread will have a sort of
half the list. the main thread will wait the two threads to finish,
then he will take care of merging the two lists from the sort of two
other threads. at the end we will have a sorted list. to merge the two
lists should not be the sort of conventional manner.
I try like this in class ListePersonne and this class sort an ArrayList:
Thread T1 = new ListePersonne( mylist.subList(0, unique.size()/2));
Thread T2 = new ListePersonne(mylist.subList(unique.size()/2, unique.size()) );
T1.start();
T2.start();
but in the result I got just the 1st part done but not the 2nd
1) Check that before merging sorting of both sublists is completed
2) Check that you use synchronized access to array list from multiple threads.