title: how to compare two hashmaps and display true for the same values?
body: <p>i have written a program for two hashmaps which has same keys but different values </p>
  
  <p>Session Key and Values
  1 : red
  2 : green
  3 : blue
  4 : violet</p>
  
  <p>Database Key and Values
  1 : gray
  2 : pink
  3 : blue
  4 : black</p>
  
  <p>what i want to achieve is compare both hashmaps values and list everything but the ones with the same values should be displayed as true 
  like this 
  1 red grey false
  2 green pink false
  3 blue blue true
  4 violet black false</p>
  
  <p>ClassComparator.java : i have just written this program to print the values of both the hashmaps , please i need some assistance to solve the further query.</p>
  
  <pre><code>public class ClassComparator {
  
  Map&lt;Integer, String&gt; sessionValues;
  Map&lt;Integer, String&gt; dbValues;
  Map&lt;Integer, String&gt; combineKeyValues;
  
  public ClassComparator() {
      // /////popuulate session Values
      combineKeyValues = new HashMap&lt;Integer, String&gt;();
      sessionValues = new HashMap&lt;Integer, String&gt;();
      sessionValues.put(1, "red");
      sessionValues.put(2, "green");
      sessionValues.put(3, "blue");
      sessionValues.put(4, "violet");
      System.out.println("Session Values : " + sessionValues);
      dbValues = new HashMap&lt;Integer, String&gt;();
      dbValues.put(1, "gray");
      dbValues.put(2, "pink");
      dbValues.put(3, "blue");
      dbValues.put(4, "black");
      System.out.println("Database Values : " + dbValues);
      System.out.println("");
  }
  
  public List&lt;QuestionResult&gt; compareValues() {
      List&lt;QuestionResult&gt; results = new ArrayList&lt;QuestionResult&gt;();
  
      // /// comparison logic
      System.out.println("Session Key and Values");
      for (Map.Entry&lt;Integer, String&gt; sessionEntry : sessionValues.entrySet()) {
          System.out.println(sessionEntry.getKey() + " : " + 
          sessionEntry.getValue());
      }
      System.out.println("");
      System.out.println("Database Key and Values");
      for (Map.Entry&lt;Integer, String&gt; dbEntry : dbValues.entrySet()) {
          System.out.println(dbEntry.getKey() + " : " + dbEntry.getValue());
      }
  
      return results;
  }
  
  public static void main(String args[]) {
      ClassComparator cc = new ClassComparator();
      cc.compareValues();
  }
  </code></pre>
  
  <p>Thank you.</p>