loop further adds the elements of list2 with their counts into the hmap
while ( n2 != null ) { if ( hmap . containsKey ( n2 . data ) ) { int val = hmap . get ( n2 . data ) ; hmap . put ( n2 . data , val + 1 ) ; } else { hmap . put ( n2 . data , 1 ) ; } n2 = n2 . next ; }