public static < T extends BucketPoint > List < T > toList ( Map < Long , T > pointMap , Buckets buckets , BiFunction < Long , Long , T > emptyBucketFactory ) { List < T > result = new ArrayList <> ( buckets . getCount ( ) ) ; for ( int index = 0 ; index < buckets . getCount ( ) ; index ++ ) { long from = buckets . getBucketStart ( index ) ; T bucketPoint = pointMap . get ( from ) ; if ( bucketPoint == null ) { long to = from + buckets . getStep ( ) ; bucketPoint = emptyBucketFactory . apply ( from , to ) ; } result . add ( bucketPoint ) ; } return result ; }
Converts bucket points indexed by start time into a list ordered by start time . Blanks will be filled with empty bucket points .