loop inserts the elements and the count of that element of list1 into the hmap
while ( n1 != null ) { if ( hmap . ContainsKey ( n1 . data ) ) { hmap [ n1 . data ] ++ ; } else { hmap [ n1 . data ] = 1 ; } n1 = n1 . next ; }