I don’t work with Map variable types very often, however I need to in one script type that I’m running and I can’t get the output quite right (Yes, I’m OCD, sigh).
Essentially I’m declaring the Map type as <String, Integer>:
Map <String, Integer> console_values = ["Onload":0,"FCP":0,"LCP":0,"FirstByte":0,"DNS":0,"TCP":0,"DOM":0,"SSL":0,"Redirect":0,"BasePage":0,"CLS":0]
Populating using Math.round to convert any decimal values into integers
example:
/// Base Page
String jsBP = "var myCalc= Math.round((window.performance.timing.responseEnd - window.performance.timing.responseStart)); return myCalc;"
console_values ["BasePage"] = execute_js_in_console(jsBP, 'basePage')
and using a simple logfile output (for now):
KeywordUtil.logInfo ('Onload: ' + console_values["Onload"])
KeywordUtil.logInfo ('FCP: ' + console_values["FCP"])
KeywordUtil.logInfo ('LCP: ' + console_values["LCP"])
KeywordUtil.logInfo ('FirstByte: ' + console_values["FirstByte"])
KeywordUtil.logInfo ('DNS: ' + console_values["DNS"])
KeywordUtil.logInfo ('TCP: ' + console_values["TCP"])
KeywordUtil.logInfo ('DOM: ' + console_values["DOM"])
KeywordUtil.logInfo ('SSL: ' + console_values["SSL"])
KeywordUtil.logInfo ('Redirect: ' + console_values["Redirect"])
KeywordUtil.logInfo ('BasePage: ' + console_values["BasePage"])
KeywordUtil.logInfo ('CLS: ' + console_values["CLS"])
However the output is showing as decimal:
How the heck is an Integer defined value continually outputting as a decimal type?
I feel like there’s something simple I’ve got to be missing here, yet I’ve spent several hours looking at the Java MAP API and community post after community post and I just can’t get rid of the dang “decimal zero”, what am I doing incorrectly?