public StatList <KeyType, ValueType> Union(StatList <KeyType, ValueType> other) { StatList <KeyType, ValueType> union = new StatList <KeyType, ValueType>(this); foreach (ListItemStats <KeyType, ValueType> item in other.AllItems) { union.Add(item.Key, item.Value); } return(union); }
private void CopyFrom(StatList <KeyType, ValueType> source) { // figure out who to call for some future data this.keyComparer = source.keyComparer; this.valueCombiner = source.valueCombiner; // get the appropriate data to add List <ListItemStats <KeyType, ValueType> > sourceItems = new List <ListItemStats <KeyType, ValueType> >(source.NumItems); if (source.rootNode != null) { source.GetAllItems(source.rootNode, sourceItems); // add the appropriate data foreach (ListItemStats <KeyType, ValueType> item in sourceItems) { this.Add(item.Key, item.Value); } } }
public StatList(StatList <KeyType, ValueType> original) { this.CopyFrom(original); }