well...this is just my opinion, but I'd say you need to re-think your design.
Maintaining data in two parallel data structures is almost always the wrong way to do it.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Jul 10, 2010
@fred rosenberger actually I need to create an indexing system where I need to read terms from a collection of files and store the word ,frequencies and the list of files(file ids).So, what I thought about storing the word,frequency in the hashmap and the file-ids in the arraylist where the words appear.
I can't claim to understand precisely what data you are working with here, but what you most likely need to do is define a class to hold all the information associated with a key, and then put the data into instances of that class and store them in the map as the values. Your class might (for example) contain an ArrayList as a member.