code: public static Distribution addSample(double value, Distribution distribution) {
      Builder builder = distribution.toBuilder();
      switch (distribution.getBucketOptionCase()) {
        case EXPLICIT_BUCKETS:
          updateStatistics(value, builder);
          updateExplicitBuckets(value, builder);
          return builder.build();
        case EXPONENTIAL_BUCKETS:
          updateStatistics(value, builder);
          updateExponentialBuckets(value, builder);
          return builder.build();
        case LINEAR_BUCKETS:
          updateStatistics(value, builder);
          updateLinearBuckets(value, builder);
          return builder.build();
        default:
          throw new IllegalArgumentException(MSG_UNKNOWN_BUCKET_OPTION_TYPE);
      }
    }
docs: Updates as new distribution that contains value added to an existing one.
  
  @param value the sample value
  @param distribution a {@code Distribution}
  @return the updated distribution