/**
         * Return the first RecipientInformation object that matches the
         * passed in selector. Null if there are no matches.
         *
         * @param selector to identify a recipient
         * @return a single RecipientInformation object. Null if none matches.
         */
        public RecipientInformation GetFirstMatch(
            IRecipientID <RecipientInformation> selector)
        {
            ICollection <RecipientInformation> res = GetMatches(selector);

            if (res.Count == 0)
            {
                return(null);
            }

            IEnumerator <RecipientInformation> en = res.GetEnumerator();

            en.MoveNext();

            return(en.Current);
        }
        private readonly IDictionary table = Platform.CreateHashtable(); // Hashtable[RecipientID, ArrayList[RecipientInformation]]

        /// <summary>
        /// Create a store containing a collection of RecipientInformation objects.
        /// </summary>
        /// <param name="recipientInfos">A collection of recipient information objects to contain.</param>
        public RecipientInformationStore(
            ICollection <RecipientInformation> recipientInfos)
        {
            foreach (RecipientInformation recipientInfo in recipientInfos)
            {
                IRecipientID <RecipientInformation> rid  = recipientInfo.RecipientID;
                IList <RecipientInformation>        list = (IList <RecipientInformation>)table[rid];

                if (list == null)
                {
                    table[rid] = list = new List <RecipientInformation>();
                }

                list.Add(recipientInfo);
            }

            this.all = new List <RecipientInformation>(recipientInfos);
        }
 public RecipientInformation this[IRecipientID <RecipientInformation> selector]
 {
     get { return(GetFirstMatch(selector)); }
 }