This case should be impossible though. highestPriorityServers.size() can only be zero if you created a Set but did not put anything in it, although you never do that while building prioritizedServers. What could happen is that prioritizedServers.pollLastEntry() could be null, which will NPE in this version of the code but should probably return null to preserve the old behavior.

But also I think none of that will end up being relevant if the strategies are extended to understand priorities, which might be better anyway.