Using openHAB version 2.4.0
I am trying to use a hashmap in a rule for the first time.
To get started, I just wrote minimal code, to get the declaration right and start from there. I read just about all post in this forum on hashmaps. But still I don’t see what I am doing wrong.
Beginning of the rules file:
import java.util.HashMap
import java.util.Map
Within the code of a rule:
val Map<String, String> periodCodes = newHashMap("1" -> "h")
logInfo("period", periodCodes.map("1"))
I thought this map method should return the string “h”.
But when the rule gets fired, at the point where this loginfo gets executed, an error is logged:
2021-03-07 11:50:43.701 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Chart X-axis': 'map' is not a member of 'java.util.Map<java.lang.String, java.lang.String>'; line 126, column 20, length 21
Thanks in advance for any suggestions