@Override
  public int compareTo(SystemStreamPartition that) {
    if (this.system.compareTo(that.system) < 0) {
      return -1;
    } else if (this.system.compareTo(that.system) > 0) {
      return 1;
    }

    if (this.stream.compareTo(that.stream) < 0) {
      return -1;
    } else if (this.stream.compareTo(that.stream) > 0) {
      return 1;
    }

    if (this.partition.compareTo(that.partition) < 0) {
      return -1;
    } else if (this.partition.compareTo(that.partition) > 0) {
      return 1;
    }

    if (this.keyBucket < that.keyBucket) {
      return -1;
    } else if (this.keyBucket > that.keyBucket) {
      return 1;
    }
    return 0;
  }
Constructs a Samza stream partition object based upon another Samza stream and a specified partition.
@param other Reference to an already existing Samza stream.
@param partition Reference to an already existing Samza partition.
samza-api/src/main/java/org/apache/samza/system/SystemStreamPartition.java