private void insertIntoDynamicTable(int index,Header entry){
  headerList.add(entry);
  int delta=entry.hpackSize;
  if (index != -1) {
    delta-=dynamicTable[dynamicTableIndex(index)].hpackSize;
  }
  if (delta > maxDynamicTableByteCount) {
    clearDynamicTable();
    return;
  }
  int bytesToRecover=(dynamicTableByteCount + delta) - maxDynamicTableByteCount;
  int entriesEvicted=evictToRecoverBytes(bytesToRecover);
  if (index == -1) {
    if (headerCount + 1 > dynamicTable.length) {
      Header[] doubled=new Header[dynamicTable.length * 2];
      System.arraycopy(dynamicTable,0,doubled,dynamicTable.length,dynamicTable.length);
      nextHeaderIndex=dynamicTable.length - 1;
      dynamicTable=doubled;
    }
    index=nextHeaderIndex--;
    dynamicTable[index]=entry;
    headerCount++;
  }
 else {
    index+=dynamicTableIndex(index) + entriesEvicted;
    dynamicTable[index]=entry;
  }
  dynamicTableByteCount+=delta;
}

private void insertIntoDynamicTable ( int index , Header entry ) { headerList . add ( entry ) ; int delta = entry . hpackSize ; if ( index != - 1 ) { delta -= dynamicTable [ dynamicTableIndex ( index ) ] . hpackSize ; } if ( delta > maxDynamicTableByteCount ) { clearDynamicTable ( ) ; return ; } int bytesToRecover = ( dynamicTableByteCount + delta ) - maxDynamicTableByteCount ; int entriesEvicted = evictToRecoverBytes ( bytesToRecover ) ; if ( index == - 1 ) { if ( headerCount + 1 > dynamicTable . length ) { Header [ ] doubled = new Header [ dynamicTable . length * 2 ] ; System . arraycopy ( dynamicTable , 0 , doubled , dynamicTable . length , dynamicTable . length ) ; nextHeaderIndex = dynamicTable . length - 1 ; dynamicTable = doubled ; } index = nextHeaderIndex -- ; dynamicTable [ index ] = entry ; headerCount ++ ; } else { index += dynamicTableIndex ( index ) + entriesEvicted ; dynamicTable [ index ] = entry ; } dynamicTableByteCount += delta ; }
index = = - 1 when new .
