Closed kskandispersonal closed 2 years ago
I think this is by design, there is a difference between default : key
and default : "key"
in the dictionary syntax and for good reason. Using ==, despite seeming incorrect, is the way to tell those apart.
For reference:
I think it should actually be defined as new String("key")
to be really correct. Creating a dictionary / Map in code and putting "key"
would still use the key instead of the literal string, because string literals compare equal with == due to the constant pool. Another option would be a real sentinel like new Object()
.
Closing this as it seems @Clashsoft has answered.
I’m trying to get the ST lib to return the “key” as the fallback if it does not exist in the Map. I added the “default” key to the json w/ value “key” just as the MapModelAdaptor code suggests but the comparison always fails because it is using “==” instead of
value.equals()
to compare anObject
(value) with aString
(DICT_KEY).Is there a workaround for this?? Thank you for your excellent lib!!!