dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: How to see if two tables/array are equal in a hash table

Hybrid View

  1. #1
    Join Date
    Oct 2012
    Posts
    18

    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???

  2. #2
    Join Date
    Mar 2001
    Posts
    2,527

    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.

  3. #3
    Join Date
    Aug 2015
    Posts
    1

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)