Switch to using the new reduce() utility function for streams and primitives.