public virtual bool Add(object obj) { if (_map.ContainsKey(obj)) { return(false); } _map.Put(obj, obj); return(true); }
public virtual void Add(object obj) { if (_seen.ContainsKey(obj)) { return; } _queue.Add(obj); _seen.Put(obj, obj); }
public virtual void TestContainsKey() { var table = new Hashtable4(); Assert.IsFalse(table.ContainsKey(null)); Assert.IsFalse(table.ContainsKey("foo")); table.Put("foo", null); Assert.IsTrue(table.ContainsKey("foo")); table.Put("bar", "baz"); Assert.IsTrue(table.ContainsKey("bar")); Assert.IsFalse(table.ContainsKey("baz")); Assert.IsTrue(table.ContainsKey("foo")); table.Remove("foo"); Assert.IsTrue(table.ContainsKey("bar")); Assert.IsFalse(table.ContainsKey("foo")); }
public virtual void Test() { Hashtable4 ht = new Hashtable4(); ObjectContainerBase container = Container(); container.ShowInternalClasses(true); IQuery q = Db().Query(); q.Constrain(typeof(Db4oDatabase)); IObjectSet objectSet = q.Execute(); while (objectSet.HasNext()) { Db4oDatabase identity = (Db4oDatabase)objectSet.Next(); Assert.IsFalse(ht.ContainsKey(identity.i_signature)); ht.Put(identity.i_signature, string.Empty); } container.ShowInternalClasses(false); }