public byte[] next() throws IOException {
        if (!init) {
            key1 = result1.next();
            key2 = result2.next();
            init = true;
        }

        if (key1 == null && key2 == null) {
            return null;
        } else if (key1 == null) {
            byte[] result = key2;
            currentQResult = result2;
            key2 = result2.next();
            return result;
        } else if (key2 == null) {
            byte[] result = key1;
            currentQResult = result1;
            key1 = result1.next();
            return result;
        }

        int cmp = Bytes.compareTo(key1, key2);

        if (cmp == 0) {
            byte[] result = key1;
            currentQResult = result1;
            key1 = result1.next();
            key2 = result2.next();
            return result;
        } else if (cmp < 0) {
            byte[] result = key1;
            currentQResult = result1;
            key1 = result1.next();
            return result;
        } else { // cmp > 0
            byte[] result = key2;
            currentQResult = result2;
            key2 = result2.next();
            return result;
        }
    }