org.jjoost.util
Class Equalities.EntryEquality<K,V>

java.lang.Object
  extended by org.jjoost.util.Equalities.EntryEquality<K,V>
All Implemented Interfaces:
java.io.Serializable, Equality<java.util.Map.Entry<K,V>>
Enclosing class:
Equalities

public static class Equalities.EntryEquality<K,V>
extends java.lang.Object
implements Equality<java.util.Map.Entry<K,V>>

an Equality over objects of type Entry, for provided K and V; wraps a separate Equality for comparing the key and value portions of the Entry.

Author:
b.elliottsmith
See Also:
Serialized Form

Constructor Summary
Equalities.EntryEquality(Equality<? super K> keyEq, Equality<? super V> valEq)
          Construct a new EntryEquality
 
Method Summary
 boolean equates(java.util.Map.Entry<K,V> a, java.util.Map.Entry<K,V> b)
          Returns a boolean indicating if the two parameters are considered equal by this Equality
 Equality<? super K> getKeyEquality()
           
 Equality<? super V> getValueEquality()
           
 int hash(java.util.Map.Entry<K,V> o)
          Returns the hash value of the object as defined by this Equality.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Equalities.EntryEquality

public Equalities.EntryEquality(Equality<? super K> keyEq,
                                Equality<? super V> valEq)
Construct a new EntryEquality

Parameters:
keyEq - the Equality to use to compare the key portion of an Entry
valEq - the Equality to use to compare the value portion of an Entry
Method Detail

equates

public final boolean equates(java.util.Map.Entry<K,V> a,
                             java.util.Map.Entry<K,V> b)
Description copied from interface: Equality
Returns a boolean indicating if the two parameters are considered equal by this Equality

Specified by:
equates in interface Equality<java.util.Map.Entry<K,V>>
Parameters:
a - an Object of type E
b - another Object of type E
Returns:
true if this equality equates the two arguments

hash

public final int hash(java.util.Map.Entry<K,V> o)
Description copied from interface: Equality
Returns the hash value of the object as defined by this Equality. For all objects this Equality can be applied to, it should be the case that equates(a, b) ==> hash(a) == hash(b)

Specified by:
hash in interface Equality<java.util.Map.Entry<K,V>>
Parameters:
o - an Object of type E
Returns:
the hash of the parameter

getKeyEquality

public final Equality<? super K> getKeyEquality()
Returns:
the Equality to use to compare the key portion of an Entry

getValueEquality

public final Equality<? super V> getValueEquality()
Returns:
the Equality to use to compare the value portion of an Entry