@Override public Trie optimize(Trie orig){
  List<CharSequence> cmds=orig.cmds;
  List<Row> rows=new ArrayList<>();
  List<Row> orows=orig.rows;
  int remap[]=new int[orows.size()];
  for (int j=orows.size() - 1; j >= 0; j--) {
    liftUp(orows.get(j),orows);
  }
  Arrays.fill(remap,-1);
  rows=removeGaps(orig.root,orows,new ArrayList<Row>(),remap);
  return new Trie(orig.forward,remap[orig.root],cmds,rows);
}

@ Override public Trie optimize ( Trie orig ) { List < CharSequence > cmds = orig . cmds ; List < Row > rows = new ArrayList < > ( ) ; List < Row > orows = orig . rows ; int remap [ ] = new int [ orows . size ( ) ] ; for ( int j = orows . size ( ) - 1 ; j >= 0 ; j -- ) { liftUp ( orows . get ( j ) , orows ) ; } Arrays . fill ( remap , - 1 ) ; rows = removeGaps ( orig . root , orows , new ArrayList < Row > ( ) , remap ) ; return new Trie ( orig . forward , remap [ orig . root ] , cmds , rows ) ; }
optimize ( eliminate rows with no content ) the given trie and return the reduced trie .
