In swift I can declare a dictionary (key value pairs) like so
var toppings = [
"Onions":"Red",
"Peppers":"Green",
]
What is the equivalent (declare key value pairs) in Java?
I have tried modifying an array i.e. changing...
public String[] couplets = {
"Onions",
"Peppers",
};
...to...
public String[] toppings = {
"Onions":"Red",
"Peppers":"Green",
};
...but it does not work.
I appreciate they are different languages so likely I am oversimplifying this by trying to do a straight like for like.
Essentially I would like to create a static list of key value pairs in Java.
I have googled for suggestions but all the answers seem overly complicated compared to what I can do in swift so I am wondering if there is a straightforward way - Perhaps there isn't...
Any advice is much appreciated
Thanks