如何使用哈希表在Java中比较2个文本文件 [英] how to compare 2 textfiles in java using hash table

查看:76
本文介绍了如何使用哈希表在Java中比较2个文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用哈希表在Java中比较2个文本文件

how to compare 2 textfiles in java using hash table

推荐答案

为什么要使用哈希表?与其问如何用y做x",不如告诉我们要进行哪种比较,以及为什么认为应该使用哈希表.显而易见的事情是比较任何顺序的单词是相同的.在这种情况下,您可以使用将字符串映射到数字的哈希表来存储每个字符串出现的次数.
Why would you use a hash table ? Instead of asking ''how do you do x with y'', try telling us what sort of comparison you want to do, and why you think you should use a hashtable. The obvious thing to do is to compare what words, in any order, are the same. In that case, you could use a hash table mapping strings to numbers, to store how many times each string appears.


这篇关于如何使用哈希表在Java中比较2个文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆