I have a Map with a 1:1 ratio on the optional constructor parameters for my class. The issue is that I can't do: test = new Foo(myMap);.
Is there a way to explode it out, or should I change it around such that it accepts a Map and then loop over the Map?
I was hoping I could do it by exploding the Map's key-value pairs but I don't think that is likely.
I remember a previous post discussing just accepting the Map and then parsing it inside the constructor.
There are plans to support deconstruction but this might not even be planned for maps.
I would make the parameter of type map and then do the assignment in the constructor body, or if you want final fields then in the constructor initializer list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With