示例#1
0
        /**
         * Searches this list for the specified object and returns the index of the
         * first occurrence.
         *
         * @param object
         *            the object to search for.
         * @return the index of the first occurrence of the object, or -1 if it was
         *         not found.
         */
        public virtual int indexOf(Object obj)
        {
            ListIterator <E> it = listIterator();

            if (obj != null)
            {
                while (it.hasNext())
                {
                    if (obj.equals(it.next()))
                    {
                        return(it.previousIndex());
                    }
                }
            }
            else
            {
                while (it.hasNext())
                {
                    if (it.next() == null)
                    {
                        return(it.previousIndex());
                    }
                }
            }
            return(-1);
        }
示例#2
0
 public bool hasPrevious()
 {
     return(iterator.previousIndex() >= start);
 }
示例#3
0
 public int previousIndex()
 {
     return(iterator.previousIndex());
 }