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()];Arrays.fill(remap, -1);rows = removeGaps(orig.root, rows, new ArrayList<Row>(), remap);return new Trie(orig.forward, remap[orig.root], cmds, rows);}
public virtual Trie Optimize(Trie orig){IList<string> cmds = orig.cmds;IList<Row> rows = new List<Row>();IList<Row> orows = orig.rows;int[] remap = new int[orows.Count];Arrays.Fill(remap, -1);rows = RemoveGaps(orig.root, rows, new List<Row>(), remap);return new Trie(orig.forward, remap[orig.root], cmds, rows);}