第一种方式:
import org.apache.commons.lang.StringUtils;
int is = StringUtils.countMatches("Hello my is Joeseph. It is very nice to meet you. What a wonderful day it is!", "is");
第二种方式
List<String> strings = new ArrayList<>(); Map<String, Integer> collect = strings.parallelStream().collect(Collectors.toConcurrentMap(w -> w, w -> 1, Integer::sum)); System.out.println(collect);