Map Inside Map In Java: There are only 2 type parameters to a map. You are calling gens.put (string, string) and should instead be. As already shown explained one might do it like this.

Map Inside Map In Java

Mastering Java Maps Efficient Data Management in 2023
Mastering Java Maps Efficient Data Management in 2023 from atonce.com

The only difference between a hashmap and a nested hashmap is: Gens is mapping string to hashmap. Yes, you can do it.

Map Inside Map In Java: Gens is mapping string to hashmap. Web a nested hashmap is map inside a map. Web a map<k,v> is a mapping from keys of type k to values of type v.