@Deprecated
    public void compact(boolean exhaustive)
    {
        if (!isCompact) {
            int limitCompacted = 0;
            int iBlockStart = 0;
            char iUntouched = 0xFFFF;

            for (int i = 0; i < indices.length; ++i, iBlockStart += BLOCKCOUNT) {
                indices[i] = 0xFFFF;
                boolean touched = blockTouched(i);
                if (!touched && iUntouched != 0xFFFF) {
                    // If no values in this block were set, we can just set its
                    // index to be the same as some other block with no values
                    // set, assuming we've seen one yet.
                    indices[i] = iUntouched;
                } else {
                    int jBlockStart = 0;
                    int j = 0;
                    for (j = 0; j < limitCompacted;
                            ++j, jBlockStart += BLOCKCOUNT) {
                        if (hashes[i] == hashes[j] &&
                                arrayRegionMatches(values, iBlockStart,
                                values, jBlockStart, BLOCKCOUNT)) {
                            indices[i] = (char)jBlockStart;
                            break;
                        }
                    }
                    if (indices[i] == 0xFFFF) {
                        // we didn't match, so copy & update
                        System.arraycopy(values, iBlockStart,
                            values, jBlockStart, BLOCKCOUNT);
                        indices[i] = (char)jBlockStart;
                        hashes[j] = hashes[i];
                        ++limitCompacted;

                        if (!touched) {
                            // If this is the first untouched block we've seen,
                            // remember its index.
                            iUntouched = (char)jBlockStart;
                        }
                    }
                }
            }
            // we are done compacting, so now make the array shorter
            int newSize = limitCompacted*BLOCKCOUNT;
            byte[] result = new byte[newSize];
            System.arraycopy(values, 0, result, 0, newSize);
            values = result;
            isCompact = true;
            hashes = null;
        }
    }
@ Deprecated public void compact ( boolean exhaustive ) { if ( ! isCompact ) { int limitCompacted = 0 ; int iBlockStart = 0 ; char iUntouched = 0xFFFF ; for ( int i = 0 ; i < indices . length ; ++ i , iBlockStart += BLOCKCOUNT ) { indices [ i ] = 0xFFFF ; boolean touched = blockTouched ( i ) ; if ( ! touched && iUntouched != 0xFFFF ) { indices [ i ] = iUntouched ; } else { int jBlockStart = 0 ; int j = 0 ; for ( j = 0 ; j < limitCompacted ; ++ j , jBlockStart += BLOCKCOUNT ) { if ( hashes [ i ] == hashes [ j ] && arrayRegionMatches ( values , iBlockStart , values , jBlockStart , BLOCKCOUNT ) ) { indices [ i ] = ( char ) jBlockStart ; break ; } } if ( indices [ i ] == 0xFFFF ) { System . arraycopy ( values , iBlockStart , values , jBlockStart , BLOCKCOUNT ) ; indices [ i ] = ( char ) jBlockStart ; hashes [ j ] = hashes [ i ] ; ++ limitCompacted ; if ( ! touched ) { iUntouched = ( char ) jBlockStart ; } } } } int newSize = limitCompacted * BLOCKCOUNT ; byte [ ] result = new byte [ newSize ] ; System . arraycopy ( values , 0 , result , 0 , newSize ) ; values = result ; isCompact = true ; hashes = null ; } }
Compact the array.
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android