While working on a project, we were faced with classical datastructure problem of achieving a balance between space and time cost. HashMap datastructure allows to have a quicker access to data but has the overhead of space. Other linear datastructures has slower access to data with less hit on the space. The following post in the java forum provides a good insight into the space occupied by a HashMap based implementation to store the data.
Otherwise the HashMap can be tweaked with the initial capacity and load factor to suit to need.