public long fiNextNonEmpty ( long cookie ) { if ( cookie == - 1L ) return - 1L ; final Object [ ] table = this . table ; final int len = table . length ; int ri = ( int ) ( cookie >> 32 ) ; int ci = ( int ) cookie ; Object item = table [ ri ] ; if ( item instanceof HeaderValues [ ] ) { final HeaderValues [ ] row = ( HeaderValues [ ] ) item ; final int rowLen = row . length ; if ( ++ ci >= rowLen ) { ri ++ ; ci = 0 ; } else if ( row [ ci ] != null && ! row [ ci ] . isEmpty ( ) ) { return ( long ) ri << 32L | ( ci & 0xffffffff L ) ; } } else { ri ++ ; ci = 0 ; } while ( ri < len ) { item = table [ ri ] ; if ( item instanceof HeaderValues && ! ( ( HeaderValues ) item ) . isEmpty ( ) ) { return ( long ) ri << 32L ; } else if ( item instanceof HeaderValues [ ] ) { final HeaderValues [ ] row = ( HeaderValues [ ] ) item ; final int rowLen = row . length ; while ( ci < rowLen ) { if ( row [ ci ] != null && ! row [ ci ] . isEmpty ( ) ) { return ( long ) ri << 32L | ( ci & 0xffffffff L ) ; } ci ++ ; } } ci = 0 ; ri ++ ; } return - 1L ; }
Find the next non - empty index in a fast iteration .