HashSet<Integer> hashSet = new HashSet<Integer>();
for (int i = resultDoctorDetails.size() - 1; i >= 0; --i) {
ResultDoctorDetail temp = resultDoctorDetails.get(i);
if (!hashSet.contains(temp.getUserId())) {
hashSet.add(temp.getUserId());
} else {
resultDoctorDetails.remove(i);
}
}