public class Pair<K,V> {
  private final K key;
  private final V value;
  
  public Pair(K k, V v) {
    key = k;
    value = v;
  }
  
  public K getKey() { return key; }
  public V getValue() { return value; }
  
  public boolean equals(Object other) {
    if (! (other instanceof Pair)) return false;
    else {
      final Pair otherPair = (Pair) other;
      return this.getKey().equals(otherPair.getKey()) && this.getValue().equals(otherPair.getValue());
    }
  }
  
  public String toString() { return "[" + getKey() + ", " + getValue() + "]"; }
}
    
        
  