Example #1
0
        public Spot get(Spot x)
        {
            Spot tmp = first;

            while (tmp != null)
            {
                if (tmp.Equals(x))
                {
                    if (tmp.previous != null)
                    {
                        tmp.previous.next = tmp.next;
                    }
                    else
                    {
                        first = tmp.next;
                    }

                    if (tmp.next != null)
                    {
                        tmp.next.previous = tmp.previous;
                    }
                    else
                    {
                        last = tmp.previous;
                    }

                    length--;
                    return(tmp);
                }
                tmp = tmp.next;
            }
            return(null);
        }
Example #2
0
        public Boolean contains(Spot x)
        {
            Spot tmp = first;

            while (tmp != null)
            {
                if (tmp.Equals(x))
                {
                    return(true);
                }
                tmp = tmp.next;
            }
            return(false);
        }