How do you initialize a map in Java?

We can also initialize the map using the double-brace syntax: Map<String, String> doubleBraceMap = new HashMap<String, String>() {{ put(“key1”, “value1”); put(“key2”, “value2”); }};

Sizin İçin Seçtik  Why is HashMap containsKey O 1?

Leave a Reply

Your email address will not be published. Required fields are marked *

How do you initialize a map in Java?

We can also initialize the map using the double-brace syntax: Map<String, String> doubleBraceMap = new HashMap<String, String>() {{ put(“key1”, “value1”); put(“key2”, “value2”); }};

Sizin İçin Seçtik  İTÜ AKTS ne demek?

Leave a Reply

Your email address will not be published. Required fields are marked *