public class Sorting {
/**
* 统计每个单词出现的次数 this is a cat and that is a mice and where is the food?
* HashMap分拣存储 思想:实现1:N 一对多(一个键多个值) 分组:一个键一个容器
*
* 1、分割字符串(按照空格来切割) 2、分拣存储 3、按要求查看 单词出现的次数
*/
public static void main(String[] args) {
// 1、分割字符串(按照空格来切割)
String str = "this is a cat and that is a mice and where is the food";
String[] arr = str.split(" ");
// 2、分拣存储
Map<Strin
HashMap分拣存储1:统计每个单词出现的次数
最新推荐文章于 2024-06-13 08:07:00 发布