public int originalSize ( ) { Block < T > currentHeadBlock = getHeadBlock ( ) ; int head = currentHeadBlock . head ( ) ; int size = 0 ; while ( true ) { if ( head == getBlockSize ( ) ) { Block < T > nextHeadBlock = currentHeadBlock . next ( ) ; if ( nextHeadBlock == null ) { break ; } else { // Use next block and loop currentHeadBlock = nextHeadBlock ; head = currentHeadBlock . head ( ) ; } } else { Object element = currentHeadBlock . peek ( head ) ; if ( element == REMOVED_ELEMENT ) { // Already removed, try next index ++ head ; } else if ( element != null ) { ++ size ; ++ head ; } else { break ; } } } return size ; }
this method has been modified from original jetty version it only returns a size rounded to blockSize