Exemple #1
0
        /// <summary>
        /// This will return a new instance that combines the source instance's data with additional results - if results are being updated then the Remove method should
        /// be called first to ensure that duplicate match data entries are not present in the returned index. This will never return null. It will throw an exception for
        /// a null data reference or one that contains any null references.
        /// </summary>
        public IIndexData <TKey> Add(IEnumerable <KeyValuePair <string, NonNullImmutableList <WeightedEntry <TKey> > > > data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            var newIndex = _data.Add(
                data,
                (current, toAdd) => ((current != null) && (toAdd != null)) ? current.AddRange(toAdd) : (current ?? toAdd)
                );

            return(new IndexData <TKey>(newIndex, KeyComparer, validate: false));
        }