In addition to the table itself, you can also maintain an integer member variable to track the size of the collection, increasing it every time with every new match and decreasing every time it is deleted. Thus, you can simplify the interface methods size and isEmpty :
public int size() { return this.size; } public boolean isEmpty() { return this.size == 0; }
source share