public int compareTo(Object o) {
    if (o instanceof ArgPosition) {
      ArgPosition other = (ArgPosition) o;
      int i = 0;
      while (this.path.size() > i && other.path.size() > i) {
        final int result = this.path.get(i).compareTo(other.path.get(i));
        if (result != 0) {
          return result;
        }
        i++;
      }
      if (this.path.size() <= i) {
        return -1;
      } else if (other.path.size() <= i) {
        return 1;
      } else {
        return 0;
      }
    } else {
      return 0;
    }
  }