code: private boolean nodeOnMultipleRacks(Collection<DatanodeDescriptor> nodes) {
      DatanodeDescriptor previous = null;
      for (DatanodeDescriptor node : nodes) {
        if (previous != null && !previous.getNetworkLocation().equals(node.getNetworkLocation())) {
          return true;
        }
        previous = node;
      }
      return false;
    }
docs: Checks that all the nodes in <code>nodes</code> are from the same rack or
  not.
  Result will be false only if all the nodes are from the same rack,
  otherwise true.