全部评论
可以的,这样写完全没问题
static AtomicInteger count = new AtomicInteger(0); public void fun(List<String> strings){ for(String str : strings){ new Thread(()->{ char[]strChar = str.toCharArray(); for(char s : strChar){ if(s == 'a&(417)#39;){ count.incrementAndGet(); } } }).start(); } } 这么写呗
真的没有大佬了嘛
求大佬答疑解惑,我是用线程池结合计数器实现的,然后将每个单词统计的个数放入vector集合秋后求和
相关推荐
点赞 评论 收藏
分享