Adding words to a HashMap with a key of how many times they appear
问题 I'm writing a Java program which adds all of the words on a website into a HashMap, and then assigns them a key of how many times they appear on the page. For instance, if I ran it on a page with only the words "hello, java, coffee, java", the output would be Java : 2 Coffee : 1 Hello : 1 This also ignores certain words that I don't want included. Here's what I have so far. Map<String, Integer> found = new HashMap<>(); // (word,frequency) Matcher match = Pattern.compile(word_pattern).matcher