Check if nodes of current levels are anagrams or not .
Collections . sort ( curr_level1 ) ; Collections . sort ( curr_level2 ) ; if ( ! curr_level1 . equals ( curr_level2 ) ) return false ; } return true ; }