protected void setLocations(Path originPath, Path... alternativePaths) {
    assert this.locations == null : "Link locations already set";

    List<Path> paths = new ArrayList<>(alternativePaths.length + 1);
    if (originPath != null) {
      paths.add(originPath);
    }

    for (int i = 0; i < alternativePaths.length; i++) {
      if (alternativePaths[i] != null) {
        paths.add(alternativePaths[i]);
      }
    }
    this.locations = paths.toArray(new Path[0]);
  }
NOTE: This method must be used only in the constructor! It creates a List with the specified
locations for the link.
hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java