public RegionLocations removeByServer(ServerName serverName) {
    HRegionLocation[] newLocations = null;
    for (int i = 0; i < locations.length; i++) {
      // check whether something to remove
      if (locations[i] != null && serverName.equals(locations[i].getServerName())) {
        if (newLocations == null) { // first time
          newLocations = new HRegionLocation[locations.length];
          System.arraycopy(locations, 0, newLocations, 0, i);
        }
        newLocations[i] = null;
      } else if (newLocations != null) {
        newLocations[i] = locations[i];
      }
    }
    return newLocations == null ? this : new RegionLocations(newLocations);
  }
Returns a new RegionLocations with the locations removed (set to null) which have the
destination server as given.
@param serverName the serverName to remove locations of
@return an RegionLocations object with removed locations or the same object if nothing is
        removed
hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLocations.java