hollow/src/main/java/com/netflix/hollow/core/memory/ByteArrayOrdinalMap.java
public void prepareForWrite() {
        int maxOrdinal = 0;
        AtomicLongArray pao = pointersAndOrdinals;

        for (int i = 0; i < pao.length(); i++) {
            long key = pao.get(i);
            if (key != EMPTY_BUCKET_VALUE) {
                int ordinal = (int) (key >>> BITS_PER_POINTER);
                if (ordinal > maxOrdinal) {
                    maxOrdinal = ordinal;
                }
            }
        }

        long[] pbo = new long[maxOrdinal + 1];
        Arrays.fill(pbo, -1);

        for (int i = 0; i < pao.length(); i++) {
            long key = pao.get(i);
            if (key != EMPTY_BUCKET_VALUE) {
                int ordinal = (int) (key >>> BITS_PER_POINTER);
                pbo[ordinal] = key & POINTER_MASK;
            }
        }

        pointersByOrdinal = pbo;
    }
public void prepareForWrite() {
        int maxOrdinal = 0;
        AtomicLongArray pao = pointersAndOrdinals;

        for (int i = 0; i < pao.length(); i++) {
            long key = pao.get(i);
            if (key != EMPTY_BUCKET_VALUE) {
                int ordinal = (int) (key >>> BITS_PER_POINTER);
                if (ordinal > maxOrdinal) {
                    maxOrdinal = ordinal;
                }
            }
        }

        long[] pbo = new long[maxOrdinal + 1];
        Arrays.fill(pbo, -1);

        for (int i = 0; i < pao.length(); i++) {
            long key = pao.get(i);
            if (key != EMPTY_BUCKET_VALUE) {
                int ordinal = (int) (key >>> BITS_PER_POINTER);
                pbo[ordinal] = key & POINTER_MASK;
            }
        }

        pointersByOrdinal = pbo;
    }
public void prepareForWrite ( ) { int maxOrdinal = 0 ; AtomicLongArray pao = pointersAndOrdinals ; for ( int i = 0 ; i < pao . length ( ) ; i ++ ) { long key = pao . get ( i ) ; if ( key != EMPTY_BUCKET_VALUE ) { int ordinal = ( int ) ( key >>> BITS_PER_POINTER ) ; if ( ordinal > maxOrdinal ) { maxOrdinal = ordinal ; } } } long [ ] pbo = new long [ maxOrdinal + 1 ] ; Arrays . fill ( pbo , - 1 ) ; for ( int i = 0 ; i < pao . length ( ) ; i ++ ) { long key = pao . get ( i ) ; if ( key != EMPTY_BUCKET_VALUE ) { int ordinal = ( int ) ( key >>> BITS_PER_POINTER ) ; pbo [ ordinal ] = key & POINTER_MASK ; } } pointersByOrdinal = pbo ; }
Create an array mapping the ordinals to pointers, so that they can be easily looked up
when writing to blob streams.
Create an array mapping the ordinals to pointers so that they can be easily looked up when writing to blob streams .