# Interface BinList.Result

Enclosing interface:
  `BinList`

public static interface BinList.Result
Accessor for the results of accumulating values in a bit list.

Since:
  20 Sep 2015
Author:
  Mark Taylor

## Method Summary

Modifier and Type
Method
Description
`BinList.Result`
`compact()`
Returns a Result instance with behaviour the same as this one, but with implementation optimised for long-term storage.
`long`
`getBinCount()`
Returns the number of bins actually populated.
`double`
`getBinValue(long index)`
Returns the value that has been accumulated into the given bin index.
`Iterator<Long>`
`indexIterator()`
Returns an iterator over the indices of the populated bins int this result.

## Method Details

### getBinValue

double getBinValue(long index)
Returns the value that has been accumulated into the given bin index. The value is the result of using this object's Combiner to combine the submitted values. In general, if no values have been submitted to the bin in question, a NaN should be returned. Note: if this result has been produced by a `Combiner`, it should generally be multiplied by the `binFactor` before use.

Parameters:
  `index` - bin index
Returns:
  bin value

### getBinCount

long getBinCount()
Returns the number of bins actually populated. This is the number of values that will be returned by `indexIterator()`.

Returns:
  number of non-empty bins

### indexIterator

Iterator<Long> indexIterator()
Returns an iterator over the indices of the populated bins int this result.

Returns:
  iterator over distinct indices of all the non-empty bins; none of the values will be larger than the BinList's size

### compact

BinList.Result compact()
Returns a Result instance with behaviour the same as this one, but with implementation optimised for long-term storage. If you're only going to iterate over this object's values once, don't call this method, since it will probably iterate over the values anyway if it does anything at all. But if you're going to keep the result around for potentially multiple uses, retaining the output of this method, rather than the original object, may be more efficient on memory.

Returns:
  compacted result with the same content as this; may return this object