public static List<? extends Tree> getAncestors(Tree t) {if ( t.getParent()==null ) return Collections.emptyList();List<Tree> ancestors = new ArrayList<Tree>();t = t.getParent();while ( t!=null ) {ancestors.add(0, t); t = t.getParent();}return ancestors;}

public static IList<ITree> GetAncestors(ITree t){if (t.Parent == null){return Collections.EmptyList<ITree>();}IList<ITree> ancestors = new List<ITree>();t = t.Parent;while (t != null){ancestors.Insert(0, t);t = t.Parent;}return ancestors;}
