In my class, I declare a static Hashmap<K, V> where my V points to an
inner class within my class.
Option 1) When I attempt to define a static block to initialize the Hashmap, the compiler
complains with
because of:
That new
Apple is my
inner class. This does not work.
Option 2) If I keep
Apple as an
inner class, and I choose to make a non-static-initialization block in my class, and make a new instance of my class
in main, this works!! Yeaaaah!!! Works great.... just not for my nitpicker. I am throwing away a newly created object, never using it. Wrong direction to go.
Option 3) If I keep
Apple as an
inner class, and put the init code in the constructor for my class, and make a new instance of my class in main, this works.
Yeah!!! .... would not work for my nitpicker. Same reasons as Option 2.
Option 4) If I move the
Apple class out of my class, making it an
outer class, all is well with the compiler. The static block works great!!!
:wine_and_cheeze: :broken_record: This is not accepatble to my nitpicker. Wants
inner classes.
:nitpicker_rules:
Does this sound like a familiar Thing? My nitpicker only wants
inner classes, and no craziness, which I keep wrapping
my head around Option 1, which still doesn't work?
Any pointers, pushes or fresh approaches are appreciated!
... Need I say more.