Esempio n. 1
0
        /// <summary>
        /// Looks up a value associated with a given key
        /// </summary>
        /// <param name="key">The key</param>
        /// <param name="value">The value associated with this key (out parameter), or the default value if not found</param>
        /// <returns>True if there a value associated with the key was found, false otherwise.</returns>
        public bool TryGetValue(T key, out S value)
        {
            Maplet /*?*/ p      = null;
            bool         foundp = ((object)elems == null ? false : elems.TryGetValue(new Maplet(new Pair <T, S>(key, default(S))), out p));

            value = foundp ? p.d.Second : default(S);
            return(foundp);
        }
Esempio n. 2
0
        /// <summary>
        /// Tests whether the given element is found in the set.
        /// </summary>
        /// <param name="item">The item to find</param>
        /// <returns>True, if the <paramref name="item"/> is in this set, false otherwise.</returns>
        /// <remarks>
        /// Complexity: O(log(this.Count))
        /// </remarks>
        public override bool Contains(T item)
        {
            T /*?*/ value;

            return((object)elems == null ? false : elems.TryGetValue(item, out value));
        }