I am struggling to port some older code from a jvm...
# multiplatform
h
I am struggling to port some older code from a jvm-only project to combined jvm/js. One of my classes was extending java.util.HashMap, which is now impossible, of course, as the kotlin HashMap is a final class. Seems I have two options: 1) implement Map and add
entries()
,
keys()
,
size()
,
containsKey()
etc or 2) remove class inheritance and reduce the map to a backing field. Or did I miss something? (Hoping so. Would like to change as little as possible.)
o
Maybe a class delegation, depends what you want to do
Implement map that way
g
Maybe you could use delegation for this and delegate all calls to MutableMap, so it would be multiplatform solution
h
I'm not using delegation, although that wouldn't be all that different. I'll pick up this thread again if I choose to use delegation!