private long findHighestId ( ) { return this . registeredServices . stream ( ) . map ( RegisteredService :: getId ) . max ( Comparator . naturalOrder ( ) ) . orElse ( 0L ) ; }
This isn t super - fast but we don t expect thousands of services .