Traverse the map
Set < Map . Entry < Integer , Integer > > hmap = map . entrySet ( ) ; for ( Map . Entry < Integer , Integer > data : hmap ) { int key = data . getKey ( ) ; int val = data . getValue ( ) ;