Bin
A histogram bin containing the items that fall within a value range.
Bin boundaries follow the half-open interval convention: items are assigned to the bin whose range contains them as [start, end), except for the last bin which is [start, end]. Boundary values (values that fall exactly on an interior bin edge) are assigned to the higher bin via floor(index) arithmetic. As a result, range (a ClosedRange) may report contains(value) == true for boundary values that are actually assigned to the adjacent bin.
This is a stable value type: its property set (range, items) is fixed and will not change in future versions.
Example:
val bins = listOf(1.0, 2.0, 3.0, 4.0, 5.0).bin(2.5)
bins[0].range // 1.0..3.5
bins[0].count // number of items in this bin
bins[0].items // the actual itemsContent copied to clipboard
Type Parameters
T
the type of items in the bin.