Grand Aggregate Java SequenceIterator Methods
The Grand Aggregate Java SequenceIterator methods produce a
doubleresult SequenceIterator, the first element of which is the operation result.SequenceIterator aggCount()Returns the count of the number of elements.SequenceIterator aggMax()Returns the maximum element value.SequenceIterator aggMin()Returns the minimum element value.SequenceIterator aggSum()Returns the sum of all elements.SequenceIterator aggPrd()Returns the product of all elements.SequenceIterator aggAvg()Returns the average of all elements.SequenceIterator aggVar()Returns the variance of elements.SequenceIterator aggVarSamp()Returns the sample variance of elements.SequenceIterator aggDev()Returns the standard deviation of elements.SequenceIterator aggDevSamp()Returns the sample standard deviation of elements.SequenceIterator aggApproxDC()Returns the approximate count of distinct values.SequenceIterator aggApproxHashDC()Returns a sequence with the approximate count of distinct values for each group for multiple sequences. WhereasaggApproxDC()returns the approximate distinct count for each group of a single sequence,aggApproxHashDC()returns the approximate distinct count for multiple sequences.SequenceIterator aggMinMax()Returns the maximum and minimum element values.Example
Following is an example code snippet demonstrating a grand aggregate function:
Cursor<Quote> cursor = new Cursor<Quote>(con, Quote.class, "symbol"); for (Quote quote : cursor) { SequenceIterator avg = quote.close.aggAvg(); Object elem = avg.next(); System.out.format("%.3f", elem); }