You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
632 B

package model;
/**
* Used to create a key made of an ip and port.
*/
public class TableKey {
private final String ip;
private final int port;
public TableKey(String ip, int port) {
this.ip = ip;
this.port = port;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TableKey)) return false;
TableKey key = (TableKey) o;
return ip == key.ip && port == key.port;
}
@Override
public int hashCode() {
int result = port;
result = 31 * result + ip.hashCode();
return result;
}
}