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

            if (obj != null)
            {
                while (it.hasPrevious())
                {
                    if (obj.equals(it.previous()))
                    {
                        return(it.nextIndex());
                    }
                }
            }
            else
            {
                while (it.hasPrevious())
                {
                    if (it.previous() == null)
                    {
                        return(it.nextIndex());
                    }
                }
            }
            return(-1);
        }
예제 #2
0
        public override bool addAll(int location, Collection <E> collection)
        {
            ListIterator <E> it    = listIterator(location);
            Iterator <E>     colIt = collection.iterator();
            int next = it.nextIndex();

            while (colIt.hasNext())
            {
                it.add(colIt.next());
            }
            return(next != it.nextIndex());
        }
예제 #3
0
 public bool hasNext()
 {
     return(iterator.nextIndex() < end);
 }
예제 #4
0
 public int nextIndex()
 {
     return(iterator.nextIndex());
 }