public void print ( PrintStream stream ) { if ( mSeries . isEmpty ( ) ) { return ; } long start = mSeries . firstKey ( ) ; stream . printf ( "Time series starts at %d with width %d.%n" , start , mWidthNano ) ; int bucketIndex = 0 ; Iterator < Map . Entry < Long , Integer > > it = mSeries . entrySet ( ) . iterator ( ) ; Map . Entry < Long , Integer > current = it . next ( ) ; while ( current != null ) { int numEvents = 0 ; if ( bucketIndex * mWidthNano + start == current . getKey ( ) ) { numEvents = current . getValue ( ) ; current = null ; if ( it . hasNext ( ) ) { current = it . next ( ) ; } } stream . printf ( "%d %d%n" , bucketIndex , numEvents ) ; bucketIndex ++ ; } }
Print the time series densely i . e . it doesn t ignore buckets with 0 events .