I have two arraylists and will like to return the difference of the two. Below is my code snippet:
@ResponseBody
@RequestMapping(value="/unpaidfees", method=RequestMethod.GET, produces="application/json")
public List<Fee> unpaid(@PathVariable("studentid") Long studentid){
Transactions tr = transServ.instalmentalstd(studentid);
List<Fee> allfees = feesServ.allFees();
if(tr != null){
List<Fee> paidfees = transServ.paidfees(tr.getTranxid());
allfees.removeAll(paidfees);
}
return allfees;
}
In summary. I have an array list which contains all fees :
List<Fee> allfees = feesServ.allFees();
And the second arraylist which contains paid fees:
List<Fee> paidfees = transServ.paidfees(tr.getTranxid());
I will like to return a list of fees present in allfees only but not in paidfees. Please advise on how to achieve this or a better way to go about this.
Thank you for your time.