示例#1
0
        private List4 Find(object obj)
        {
            List4 current = _first;

            while (current != null)
            {
                if (current.Holds(obj))
                {
                    return(current);
                }
                current = ((List4)current._next);
            }
            return(null);
        }
示例#2
0
        public virtual int IndexOf(object obj)
        {
            int   index   = 0;
            List4 current = _first;

            while (current != null)
            {
                if (current.Holds(obj))
                {
                    return(index);
                }
                index++;
                current = ((List4)current._next);
            }
            return(-1);
        }
示例#3
0
        /// <summary>
        /// removes an object from the Collection equals() comparison returns the
        /// removed object or null, if none found
        /// </summary>
        public virtual bool Remove(object a_object)
        {
            List4 previous = null;
            List4 current  = _first;

            while (current != null)
            {
                if (current.Holds(a_object))
                {
                    _size--;
                    AdjustOnRemoval(previous, current);
                    Changed();
                    return(true);
                }
                previous = current;
                current  = ((List4)current._next);
            }
            return(false);
        }