Hi Piet,
I am new here but I know a web site that you can be helped a lot with this subject and other ones.
Using stream and reduce will be much easier.
web site ->
https://www.techiedelight.com/find-maximum-minimum-custom-objects-java/#:~:text=1.,maximum%20object%20in%20the%20stream