package com.liangjian.dataplatform.member.entity.pojo;

import java.io.Serializable;

/**
 * @Author: 黄子奇
 * @Date: 2019/8/28 15:57
 */
public class KeyValuePair<A,B> implements Serializable {
    private static final long serialVersionUID = -4770959559631848707L;

    private A key;
    private B value;

    public KeyValuePair(A key, B value) {
        this.key = key;
        this.value = value;
    }

    public A getKey() {
        return key;
    }

    public void setKey(A key) {
        this.key = key;
    }

    public B getValue() {
        return value;
    }

    public void setValue(B value) {
        this.value = value;
    }

    @Override
    public int hashCode() {
        return key.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof KeyValuePair){
            return ((KeyValuePair) obj).getKey().equals(this.key) && ((KeyValuePair) obj).getValue().equals(this.value);
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        return "KeyValuePair{" +
                "key=" + key +
                ", value=" + value +
                '}';
    }
}
