Improve iteration over subnets map by using entrySet instead of keyset.