All pastes #2068559 Raw Edit

HashTableEntry.java

public java v1 · immutable
#2068559 ·published 2011-05-24 16:53 UTC
rendered paste body
package datastructs;import java.util.Objects;public class HashTableEntry<T, U> {        private T key;    private U value;    public HashTableEntry(T key, U value) {        this.key = key;        this.value = value;    }    public T getKey() {        return key;    }        public U getValue() {        return value;    }    public void setKey(T key) {        this.key = key;    }    public void setValue(U value) {        this.value = value;    }    public boolean equals(Object obj) {        if (obj == null) {            return false;        }        if (getClass() != obj.getClass()) {            return false;        }        final HashTableEntry<T, U> other = (HashTableEntry<T, U>) obj;        if (!Objects.equals(this.value, other.value)) {            return false;        }        return true;    }    public int hashCode() {        int hash = key.toString().codePointAt(0)+ key.toString().codePointAt(1) + key.toString().codePointAt(2);        return hash;    }            }