public IEnumerable <T> GetCommonElements(Hierarchy <T> other) { var commonElements = new List <T>(); foreach (var item in this.nodesByValue.Keys) { if (other.Contains(item)) { commonElements.Add(item); } } return(commonElements); }
public IEnumerable <T> GetCommonElements(Hierarchy <T> other) { List <T> collection = new List <T>(); foreach (var kvp in this._nodesByValue) { if (other.Contains(kvp.Key)) { collection.Add(kvp.Key); } } return(collection); }
public IEnumerable <T> GetCommonElements(Hierarchy <T> other) { List <T> commonElements = new List <T>(); foreach (var key in this.hierarchy.Keys) { if (other.Contains(key)) { commonElements.Add(key); } } return(commonElements); }
public IEnumerable <T> GetCommonElements(Hierarchy <T> other) { List <T> collection = new List <T>(); foreach (var kvp in this.nodesByValue) { if (other.Contains(kvp.Key)) { collection.Add(kvp.Key); } } return(collection); //var result = new HashSet<T>(this.nodesByValue.Keys); //result // .IntersectWith(new HashSet<T>(this.nodesByValue.Keys)); //return result; }