It depends, but if your data model is simple enough to fit into the map, and you do not need to save data between runs of your program, then the database in memory is likely to be redundant. Databases are designed for more complex data models, secure concurrent access and updates using transactions, complex queries, restrictions, etc.
, , , . , java.util.collections, Google, Java . java.util.concurrent, ConcurrentHashMap, .
, . HashMap, .
, - , . , , .