public void AddRange(IEnumerable <T> items) { items.CheckNotNull("items"); var list = items as ImmList <T>; if (list != null) { _inner = _inner.AddLastList(list.Root, _lineage); } else { int len; var arr = items.ToArrayFast(out len); int i = 0; var tree = FingerTree <T> .FTree <Leaf <T> > .Construct(arr, ref i, len, _lineage); _inner = _inner.AddLastList(tree, _lineage); } }
/// <summary> /// Adds the specified list to the end of this one. /// </summary> /// <param name="list"> The list. </param> /// <returns> </returns> ImmList <T> AddLastList(ImmList <T> list) { if (list.IsEmpty) { return(this); } if (IsEmpty) { return(list); } var result = Root.AddLastList(list.Root, Lineage.Immutable); return(result.Wrap()); }