In a previous post: Populate manually a HasMap just like a dictionary in pyhton I was wondering how to manually populate what in python is called dictionary. I was suggested to read this link: How to directly initialize a HashMap (in a literal way)?
After reading it, I realized that I didn't explain myself correctly, so I ask the question again. In python I have a dictionary.py file with these dictionaries:
convert_en_it = {"Mon": "Mon", "Tue": "Tue", "Wed": "Wed", "Thu": "Thurs", "Fri": "Fri", "Sat": "Sat" , "Sun": "Sun"}
convert_number_month = {"1": "January", "2": "February", "3": "March", "4": "April", "5": "May", "6": "June" ,
"7": "July", "8": "August", "9": "September", "10": "October", "11": "November",
"12": "December"}
conv_simb = {"P": "P", "M": "M", "S": "S", "CM": "E", "CP": "D", "CS": "T" , "VP": "F", "VM": "G", "VS": "R",
"NM": "U", "NP": "W", "PM": "H", "PP": "L", "EM": "A", "EP": "B", "ES ": "IF", "AM": "I",
"AP": "J", "AS": "K", "BM": "N", "BP": "O", "BS": "Q", "X": "X", "- -": "V", "Y": "Y", "Z": "Z",
"ME": 'a', "BT": "c"}
conv_to_location = {"M": "M", "P": "P", "S": "S", "D": "CP", "E": "CM", "T": "CS" , "F": "VP", "G": "VM", "R": "VS",
"Z": "Z", "A": "EM", "B": "EP", "C": "ES", "I": "AM", "J": "AP", "K ": "AS",
"N": "BM", "O": "BP", "Q": "BS", "U": "NM", "W": "NP","H": "PM", "L ": "PP", "Y": "Y", "X": "x",
"V": "--", "": ' ', "a": "ME", "c": "BT"}
sel_hour = {"M": 3.5, "P": 5, "S": 3, "D": 6, "E": 6, "T": 3, "F": 5, "G": 3.5 , "R": 3.5,
"Z": 9, "A": 3.5, "B": 4.5, "C": 3.5, "I": 5, "J": 5, "K": 4, "N": 5, "O ": 5, "Q": 4,
"H": 5, "L": 5, "U": 4, "W": 4, "Y": 9, "c": 9, "u": 10, "a": 8.5}
which_table = {"Z": "biblio", "Y": "show", "M": "permanent", "P": "permanent",
"S": "permanent", "D": "show", "E": "show", "T": "show", "F": "extra", "G": "extra",
"R": "extra", "H": "pieces", "L": "pieces", "A": "educational", "B": "educational",
"C": "educational", "I": "artcity", "J": "artcity", "K": "artcity", "N": "artcity",
"O": "artcity", "Q": "artcity", "U": "esprit", "W": "esprit"}
plus another dozen similar.
In the link recommended to me (see above) the only answer that could do for me was the following:
// this works for any number of elements:
import static java.util.Map.entry;
Map<String, String> test2 = Map.ofEntries(
entry("a", "b"),
entry("c", "d")
);
which leads me to think that for each of the about 20 dictionaries I have in python I have to do a run-time initialization of that type.
Or is there something that allows me to have a dictionary.java file with content similar to dictionary.py