public void insert ( String key , char val ) { // make sure we have enough room in the arrays int len = key . length ( ) + 1 ; // maximum number of nodes that may be generated if ( freenode + len > eq . length ) { redimNodeArrays ( eq . length + BLOCK_SIZE ) ; } char strkey [ ] = new char [ len -- ] ; key . getChars ( 0 , len , strkey , 0 ) ; strkey [ len ] = 0 ; root = insert ( root , strkey , 0 , val ) ; }
Branches are initially compressed needing one node per key plus the size of the string key . They are decompressed as needed when another key with same prefix is inserted . This saves a lot of space specially for long keys .