@Override
    public boolean equals(Object other) {
        if (this == other) {
            return true;
        }

        if (other == null || getClass() != other.getClass()) {
            return false;
        }

        Pair<?, ?> pair = (Pair<?, ?>) other;
        return Objects.equals(first, pair.first) &&
                Objects.equals(second, pair.second);
    }