I have a requirement like this : (1) I have a HashMap , whose keys are boolean values to indicate whether value is selected or not , and values are a class objects(having fields like name,addressLine1). Now these 2 fields (name and addressLine1 are the attributs of another class object whose collection I will display on screen. i.e. scenario is display Object1 with it's details along with List of Object2 which lies in Object1 (2) Now , I have crated the HashMap . My logic to cater my need is , I will iterate over this HashMap , see if key is false(meaning not selected and hence to be selected) , populate Object1 with respective details from this HashMap values , and set the same Key as false(so that future iteration takes care of this ....) How can I modify HashMap keys ? (Note: Willhave each such Object1s as unique for each user and hence not created thsi HashMap as static)