This is my method which used to populate a map, and there's other data will be added in the future.
public class myClass{
public Map populateMap(client: RedissonClient) {
Map map = client.getMap("map");
map.put(k1, v1);
map.put(k2, v2);
...
return map;
}
}
The problem is, each time when I calling this method in my main function, it will re-create the same map content again and again, is there a way to define it as a constant map object, not in a method.
Map map = myClass.populateMap(client);
...