Map stores the words present in list L against it 's occurrences inside list L
HashMap < String , Integer > hashMap = new HashMap < String , Integer > ( ) ; for ( String word : B ) { hashMap . put ( word , hashMap . getOrDefault ( word , 0 ) + 1 ) ; } for ( int i = 0 ; i <= n - size_l ; i ++ ) { HashMap < String , Integer > tempMap = ( HashMap < String , Integer > ) hashMap . clone ( ) ; int j = i , count = word_count ;