func (it *ConnectionInfoIterator) Next() *ClusterConnectionInfo {
	for it.currPriority < len(it.orderedPriorities) {
		// Get clusters with the highest priority
		currPriority := it.orderedPriorities[it.currPriority]
		clusterPolicy := it.priorityToCluster[currPriority]

		if result := it.getClusterConnectionInfo(clusterPolicy); result == nil {
			// If there is no cluster with the current priority, choose cluster with next highest priority
			it.currPriority++
		} else {
			// To avoid the same cluster again add that to a black list
			it.clusterBlackList[result.ClusterName] = true
			return result
		}
	}

	return nil
}
// Next returns the next ClusterConnectionInfo value if available or nil if iterator reaches the end.
Next returns the next ClusterConnectionInfo value if available or nil if iterator reaches the end.
// Next returns the next ClusterConnectionInfo value if available or nil if iterator reaches the end .
func (it *ConnectionInfoIterator) Next() *ClusterConnectionInfo {
	for it.currPriority < len(it.orderedPriorities) {
		currPriority := it.orderedPriorities[it.currPriority]
		clusterPolicy := it.priorityToCluster[currPriority]
		if result := it.getClusterConnectionInfo(clusterPolicy); result == nil {
			it.currPriority++
		} else {
			it.clusterBlackList[result.ClusterName] = true
			return result
		}
	}
	return nil
}
func ( it * ConnectionInfoIterator ) Next ( ) * ClusterConnectionInfo { for it . currPriority < len ( it . orderedPriorities ) { currPriority := it . orderedPriorities [ it . currPriority ] clusterPolicy := it . priorityToCluster [ currPriority ] if result := it . getClusterConnectionInfo ( clusterPolicy ) ; result == nil { it . currPriority ++ } else { it . clusterBlackList [ result . ClusterName ] = true return result } } return nil }
Next returns the next ClusterConnectionInfo value if available or nil if iterator reaches the end.
Next returns the next ClusterConnectionInfo value if available or nil if iterator reaches the end .
// Get clusters with the highest priority // If there is no cluster with the current priority, choose cluster with next highest priority // To avoid the same cluster again add that to a black list