public void IndexedVector_Mutations()
        {
            IndexedVector <string, VectorMember <string> > vector = new IndexedVector <string, VectorMember <string> >();
            var item = new VectorMember <string> {
                Key = "foobar"
            };

            Assert.IsFalse(vector.ContainsKey(item.Key));
            Assert.IsFalse(vector.TryGetValue(item.Key, out _));
            Assert.AreEqual(0, vector.Count);
            Assert.AreEqual(0, vector.Count());
            Assert.IsTrue(vector.Add(item));
            Assert.IsFalse(vector.Add(item));
            Assert.IsTrue(vector.ContainsKey(item.Key));
            Assert.IsTrue(vector.TryGetValue(item.Key, out _));
            Assert.AreEqual(1, vector.Count);
            Assert.AreEqual(1, vector.Count());
            Assert.IsTrue(vector.Remove(item.Key));
            Assert.IsFalse(vector.Remove(item.Key));
            Assert.AreEqual(0, vector.Count);
            Assert.AreEqual(0, vector.Count());
            Assert.IsTrue(vector.Add(item));
            Assert.AreEqual(1, vector.Count);
            Assert.AreEqual(1, vector.Count());
            vector.Clear();
            Assert.AreEqual(0, vector.Count);
            Assert.AreEqual(0, vector.Count());
            Assert.IsFalse(vector.ContainsKey(item.Key));
            Assert.IsFalse(vector.TryGetValue(item.Key, out _));
        }
    public static IIndexedVector <TKey, TValue>?Clone <TKey, TValue>(IIndexedVector <TKey, TValue>?source, Func <TValue, TValue> cloneItem)
        where TKey : notnull
        where TValue : class
    {
        if (source is null)
        {
            return(null);
        }

        IndexedVector <TKey, TValue> vector = new IndexedVector <TKey, TValue>(source.Count);

        foreach (var pair in source)
        {
            var item = cloneItem(pair.Value);
            vector.Add(item);
        }

        return(vector);
    }