package mpi; import java.io.Serializable; import java.util.List; import java.util.Random; import java.util.Vector; public class IndependentDataParallelism { /* */ interface Task extends Serializable{ Out execute(In input); } /* */ public Vector doSequential(List data, Task task){ Vector result = new Vector(data.size()); for(I element: data) result.add(task.execute(element)); return result; } /* compares both lists and returns number of differences */ public int compare(List l1, List l2){ if (l1.size() != l2.size()) throw new IllegalArgumentException("Both lists should have equal length"); int diff=0; for(int i=0;i v = new Vector(); Random r = new Random(); for(int i=0;i ind = new IndependentDataParallelism(); Vector result = ind.doSequential(v, new Task(){ private static final long serialVersionUID = 1L; public Boolean execute(Integer value){ for (int j=2 ; j