private static<V> LongHashTrieMap<V> mergeLeafMaps (long hash0, ALongHashMap<V> elem0, long hash1, ALongHashMap<V> elem1, int level, int size) {
        final int index0 = (int) ((hash0 >>> level) & 0x3f);
        final int index1 = (int) ((hash1 >>> level) & 0x3f);
        if(index0 != index1) {
            final long bitmap = (1L << index0) | (1L << index1);
            final ALongHashMap<V>[] elems = createArray(2);
            if(index0 < index1) {
                elems[0] = elem0;
                elems[1] = elem1;
            }
            else {
                elems[0] = elem1;
                elems[1] = elem0;
            }
            return new LongHashTrieMap<>(bitmap, elems, size);
        }
        else {
            final ALongHashMap<V>[] elems = createArray(1);
            final long bitmap = (1L << index0);
            // try again, based on the
            elems[0] = mergeLeafMaps(hash0, elem0, hash1, elem1, level + LEVEL_INCREMENT, size);
            return new LongHashTrieMap<>(bitmap, elems, size);
        }
    }
private static<V> LongHashTrieMap<V> mergeLeafMaps (long hash0, ALongHashMap<V> elem0, long hash1, ALongHashMap<V> elem1, int level, int size) {
        final int index0 = (int) ((hash0 >>> level) & 0x3f);
        final int index1 = (int) ((hash1 >>> level) & 0x3f);
        if(index0 != index1) {
            final long bitmap = (1L << index0) | (1L << index1);
            final ALongHashMap<V>[] elems = createArray(2);
            if(index0 < index1) {
                elems[0] = elem0;
                elems[1] = elem1;
            }
            else {
                elems[0] = elem1;
                elems[1] = elem0;
            }
            return new LongHashTrieMap<>(bitmap, elems, size);
        }
        else {
            final ALongHashMap<V>[] elems = createArray(1);
            final long bitmap = (1L << index0);
            
            elems[0] = mergeLeafMaps(hash0, elem0, hash1, elem1, level + LEVEL_INCREMENT, size);
            return new LongHashTrieMap<>(bitmap, elems, size);
        }
    }
private static < V > LongHashTrieMap < V > mergeLeafMaps ( long hash0 , ALongHashMap < V > elem0 , long hash1 , ALongHashMap < V > elem1 , int level , int size ) { final int index0 = ( int ) ( ( hash0 >>> level ) & 0x3f ) ; final int index1 = ( int ) ( ( hash1 >>> level ) & 0x3f ) ; if ( index0 != index1 ) { final long bitmap = ( 1L << index0 ) | ( 1L << index1 ) ; final ALongHashMap < V > [ ] elems = createArray ( 2 ) ; if ( index0 < index1 ) { elems [ 0 ] = elem0 ; elems [ 1 ] = elem1 ; } else { elems [ 0 ] = elem1 ; elems [ 1 ] = elem0 ; } return new LongHashTrieMap <> ( bitmap , elems , size ) ; } else { final ALongHashMap < V > [ ] elems = createArray ( 1 ) ; final long bitmap = ( 1L << index0 ) ; // try again, based on the elems [ 0 ] = mergeLeafMaps ( hash0 , elem0 , hash1 , elem1 , level + LEVEL_INCREMENT , size ) ; return new LongHashTrieMap <> ( bitmap , elems , size ) ; } }
very internal method. It assumes hash0 != hash1.
very internal method . It assumes hash0 ! = hash1 .