code: public RocMetric addIn(RocMetric other) {
      // Sum tpr, fpr for each threshold
      int i = 0;
      // start from 1, 0-index is for threshold value
      int j = 1;
      while (i < this.pred.length) {
        if (this.pred[i] != null) {
          if (other.pred[i] != null) {
            j = 1;
            // P = P + P
            // N = N + N
            while (j < this.pred[i].length) {
              this.pred[i][j] = this.pred[i][j] + other.pred[i][j];
              j++;
            }
          }
        } else {
          if (other.pred[i] != null) {
            j = 0;
            // P = P + P
            // N = N + N
            // this.pred[i] is currently null so need to cretae new instance
            this.pred[i] = new double[3];
            while (j < other.pred[i].length) {
              this.pred[i][j] = other.pred[i][j];
              j = j + 1;
            }
          }
        }
        i = i + 1;
      }
      return (this);
    }
docs: Sum in-place to avoid new object alloc