简体   繁体   English

java文件读取并将其存储在哈希图中<String,ArrayList>并与其他 hashMap 进行比较

[英]java file reading and storing it in a hashmap <String,ArrayList> and comparing with other hashMap

For sample data : Column1,Column2,Column3 1,abc,P 1,abc2,P 1,abc3,P 2,qqq,L 2,uuuu,L对于示例数据:Column1,Column2,Column3 1,abc,P 1,abc2,P 1,abc3,P 2,qqq,L 2,uuuu,L

So for all column1 with same value its corresponding column3 should be having same value, but it could possible that column1 and column3 not having same value.因此,对于所有具有相同值的 column1,其对应的 column3 应该具有相同的值,但 column1 和 column3 可能没有相同的值。

Eg column 1 having value 0-7 is occuring 10 times, now its corresponding column 3 having value 16 is also occuring 10 times on same elements of column2 .例如,具有值 0-7 的列 1 出现了 10 次,现在其对应的具有值 16 的列 3 在 column2 的相同元素上也出现了 10 次。 so this need to be verified on large data set.所以这需要在大数据集上进行验证。

Wanted to implement it through java, so what I trying to do create a HashMap with and then adding it for one value set, and in arraylist will add values of column2 having same corrrsponding column1 value.想通过java来实现它,所以我试图做的是创建一个HashMap,然后将它添加到一个值集,并且在arraylist中将添加具有相同corrrsponding column1值的column2的值。 similarly this will be done for column3 and column2, and then compare two hashmaps for the distinct keys of colum1,cloumn3 - is that correct appraoch ?类似地,这将对 column3 和 column2 进行,然后比较 colum1,cloumn3 的不同键的两个哈希图 - 这是正确的方法吗?

If you are trying to manipulate a xls you should use http://mvnrepository.com/artifact/org.apache.poi/poi/3.7如果您尝试操作 xls,则应使用http://mvnrepository.com/artifact/org.apache.poi/poi/3.7

It's really hard to understand that.这真的很难理解。 But I guess you what to use unique entries and count than or not.但我猜你用什么独特的条目和计数比或不。 So use:http://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html所以使用:http ://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html

and

/HashMap.html /HashMap.html

hope it helps to guide your ideas.希望它有助于指导您的想法。

ps: the more complex your solution, the more seems to be the wrong approach. ps:您的解决方案越复杂,似乎越错误的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM