@SuppressWarnings("unchecked")
	@Override
	public int compareTo(KeyValue<A, B> o) {
		int cmp = 0;

		if (key instanceof Comparable) {
			cmp = ((Comparable) key).compareTo(o.key);
			if (cmp != 0) return cmp;
		}

		if (value instanceof Comparable) {
			cmp = ((Comparable) value).compareTo(o.value);
			if (cmp != 0) return cmp;
		}

		return cmp;
	}