Please explain the second line of this code :
public boolean equals(Object other) {
HTPair op =(HTPair) other;
return this.key.equals(op.key);
}
Please explain the second line of this code :
public boolean equals(Object other) {
HTPair op =(HTPair) other;
return this.key.equals(op.key);
}
HTPair is basically short for HashTablePair. In your Hash Table, you will be storing key-value pairs, so we have defined a class called HTPair like this :
class HTPair{
int key;
int value;
}
So when you create a linkedlist of type HTPair, each node of the linkedlist will contain values of type HTPair i.e each node will have a key and value associated with it.