title: Check if all values in a map are equal
body: <p>I need to check if all values in a map are equal. I have a method to perform this task but would like to use a library or native methods. Limitations: Java 5 + Apache Commons libraries.</p>
  
  <pre><code>public static boolean isUnique(Map&lt;Dboid,?&gt; aMap){
  
  boolean isUnique = true;
  Object currValue = null;
  int iteration = 0;
  
  Iterator&lt;?&gt; it = aMap.entrySet().iterator();
  
  while(it.hasNext() &amp;&amp; isUnique){
      iteration++;
      Object value = it.next();
      if(iteration &gt; 1){
          if (value != null &amp;&amp; currValue == null ||
              value == null &amp;&amp; currValue != null ||
              value != null &amp;&amp; currValue != null &amp; !value.equals(currValue)) {
              isUnique = false;
          }
      }
      currValue = value;
  }
  return isUnique;
  }
  </code></pre>