예제 #1
0
 // Again, overriding for generics
 @Override
 public int compareTo(M o) {
   final Map<K, V> thisMap = getValue();
   final Map<K, V> otherMap = o.asMap();
   final Set<K> thisKeySet = thisMap.keySet();
   final Set<K> otherKeySet = otherMap.keySet();
   final Collection<V> thisValueSet = thisMap.values();
   final Collection<V> otherValueSet = otherMap.values();
   return ComparisonChain.start()
       .compare(thisKeySet.containsAll(otherKeySet), otherKeySet.containsAll(thisKeySet))
       .compare(thisValueSet.containsAll(otherValueSet), otherValueSet.containsAll(thisValueSet))
       .result();
 }