Quantcast
Channel: alvinalexander.com - data
Viewing all articles
Browse latest Browse all 25

How to populate static, predefined data in a Map/HashMap in Java

$
0
0

A great thing about Scala is that you can add data to a Map when you define it, but I don’t know how to do the same thing in Java, at least not easily. The closest thing I’ve been able to come up with is the following, where I define a Map/HashMap in Java, and populate its initial data like this:

read more


Viewing all articles
Browse latest Browse all 25

Trending Articles