Interface ExponentialHistogram.Buckets
- Enclosing interface:
ExponentialHistogram
public static interface ExponentialHistogram.Buckets
Represents a bucket range of an
ExponentialHistogram, either the positive or the negative range.-
Method Summary
Modifier and TypeMethodDescriptiondefault intReturns the number of buckets.iterator()default BucketIteratorReturns an iterator iterating over all buckets in the opposite direction ofiterator().long
-
Method Details
-
iterator
CopyableBucketIterator iterator()- Returns:
- a
BucketIteratorfor the populated buckets of this bucket range. TheBucketIterator.scale()of the returned iterator must be the same asExponentialHistogram.scale(). The iterator iterates on the buckets from lowest bucket index to highest bucket index, i.e. from the bucket closest to zero to the bucket closest to infinity.
-
maxBucketIndex
OptionalLong maxBucketIndex()- Returns:
- the highest populated bucket index, or an empty optional if no buckets are populated
-
valueCount
long valueCount()- Returns:
- the sum of the counts across all buckets of this range
-
bucketCount
default int bucketCount()Returns the number of buckets. Note that this operation might require iterating over all buckets, and therefore is not cheap.- Returns:
- the number of buckets
-
reverseIterator
Returns an iterator iterating over all buckets in the opposite direction ofiterator(). So the iterator iterates the buckets from the highest bucket index to the lowest, i.e. from the bucket closest to zero to the bucket closest to infinity. TheBucketIterator.scale()of the returned iterator must be the same asExponentialHistogram.scale().
Note that depending on how the buckets are stored, this method might be expensive. It might involve copying all buckets first.
-