vendredi 5 mai 2017

Good design pattern choice for initializing a hashmap in Java

I have a non-static class in Java that has a static hashmap field. The hashmap should be initialized with some key-value pairs and then not changed after that.

How should this be achieved? Should I just create a static init method and make sure to run this once before using the class, or are there better ways of doing it?

Aucun commentaire:

Enregistrer un commentaire