LinkedList<TrieNode<T>> makeSuffixChain(TrieNode<T> root,String suffix,T value){
  LinkedList<TrieNode<T>> result=new LinkedList<>();
  String rootPrefix=root.getPrefix();
  for (int i=1, suffixSize=suffix.length(); i <= suffixSize; i++) {
    String newPrefix=rootPrefix + suffix.substring(0,i);
    TrieNode<T> newNode=TrieNode.makeNode(newPrefix);
    result.add(newNode);
    root.addChild(newNode);
    root=newNode;
  }
  root.setValue(value);
  return result;
}

LinkedList < TrieNode < T > > makeSuffixChain ( TrieNode < T > root , String suffix , T value ) { LinkedList < TrieNode < T > > result = new LinkedList < > ( ) ; String rootPrefix = root . getPrefix ( ) ; for ( int i = 1 , suffixSize = suffix . length ( ) ; i <= suffixSize ; i ++ ) { String newPrefix = rootPrefix + suffix . substring ( 0 , i ) ; TrieNode < T > newNode = TrieNode . makeNode ( newPrefix ) ; result . add ( newNode ) ; root . addChild ( newNode ) ; root = newNode ; } root . setValue ( value ) ; return result ; }
inserts a chain of children into the given node .
