private Map < String , Double > getMinMax ( Map < Long , Double > metricData ) { double min = 0.0 ; double max = 0.0 ; boolean isMinMaxSet = false ; for ( Double value : metricData . values ( ) ) { double valueDouble = value ; if ( ! isMinMaxSet ) { min = valueDouble ; max = valueDouble ; isMinMaxSet = true ; } else { if ( valueDouble < min ) { min = valueDouble ; } else if ( valueDouble > max ) { max = valueDouble ; } } } Map < String , Double > minMax = new HashMap <> ( ) ; minMax . put ( "min" , min ) ; minMax . put ( "max" , max ) ; return minMax ; }
Identifies the min and max values of a metric