-
September 6th, 2015, 02:48 PM
#1
How to see if two tables/array are equal in a hash table
Hello!!
Ive created my own hash table and now i've been trying to compare two tables in where I want to see if they're equal, if not, where are the elements that are different in the array's. Can somebody give me some examples on where and how to use equals() Please???
-
September 11th, 2015, 01:06 PM
#2
Re: How to see if two tables/array are equal in a hash table
Why don't you post your code. Maybe something will jump out at us.
ahoodin
To keep the plot moving, that's why.
-
September 12th, 2015, 02:03 AM
#3
Re: How to see if two tables/array are equal in a hash table
if you have two hashtable,
Code:
Hashtable hashTable1 = new Hashtable();
Hashtable hashTable2 = new Hashtable();
then you can compare using,
Code:
for (Map.Entry<Integer, Integer> htEntries : hashTable1.entrySet()) {
if(hashTable2.containsKey(htEntries.getKey()) && hashTable2.get(htEntries.getKey()).equals(htEntries.getValue())){
System.out.println("\tKey: " + htEntries.getKey() + " Value: " + htEntries.getValue());
}
}
http://www.pointbaba.com/faq/66/how-...-table-in-java
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|