I have a txt file which contains many words. I have to extract from that file keywords. I have made this using this example http://crunchify.com/java-how-to-find-maximum-occurrence-of-words-from-text-file/ but i have as keywords also words like (the is of on and) how i can do if i want to remove this words from that Map? I have think to create a List which contains words to remove and compare with map's element.But it is an hard work...have you some ideas?
            Asked
            
        
        
            Active
            
        
            Viewed 300 times
        
    1 Answers
0
            If you create a list, you will have to check each key from that map to the list and then decide whether to remove that key,value pair or keep it.
You can use a set rather than a list, Create a set of all keys you want to remove and once your map is created use the function ->
yourMap.keySet().removeAll(setOfRemovableKeywords);
This will remove all the key value pairs you put in setOfRemovableKeywords set and will clean your map of values you do not need.
 
    
    
        Ajinkya Patil
        
- 741
- 1
- 6
- 17
