INT-3528 Use Collections min and max methods where appropriate

JIRA: https://jira.spring.io/browse/INT-3528

Use min and max methods instead of sorting an entire collection to get the minimum or maximum element.