'How to write a method using hashtable

How to implement a boolean contains(T elem){} method in a hashtable?

This is what I have:

public boolean contains (T elem) {
    if ( this.table != null || this.size != 0 ) {
        this.table = null;
        size--;
        return false;
    }
    else { return true; }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source