public void UnionCachePath(AppendableCachePath cachePath, AppendableCachePath other) { CHashSet <AppendableCachePath> otherChildren = other.children; if (otherChildren == null) { // fast case 1 return; } CHashSet <AppendableCachePath> children = cachePath.children; if (children == null) { // fast case 2 cachePath.children = otherChildren; return; } foreach (AppendableCachePath otherCachePath in otherChildren) { if (children.Add(otherCachePath)) { continue; } UnionCachePath(children.Get(otherCachePath), otherCachePath); } }