code: func UpdateEndpointsMap(endpointsMap EndpointsMap, changes *EndpointChangeTracker) (result UpdateEndpointMapResult) {
  	result.StaleEndpoints = make([]ServiceEndpoint, 0)
  	result.StaleServiceNames = make([]ServicePortName, 0)
  	result.LastChangeTriggerTimes = make([]time.Time, 0)
  
  	endpointsMap.apply(
  		changes, &result.StaleEndpoints, &result.StaleServiceNames, &result.LastChangeTriggerTimes)
  
  	// TODO: If this will appear to be computationally expensive, consider
  	// computing this incrementally similarly to endpointsMap.
  	result.HCEndpointsLocalIPSize = make(map[types.NamespacedName]int)
  	localIPs := GetLocalEndpointIPs(endpointsMap)
  	for nsn, ips := range localIPs {
  		result.HCEndpointsLocalIPSize[nsn] = len(ips)
  	}
  
  	return result
  }
docs: // UpdateEndpointsMap updates endpointsMap base on the given changes.