Hi all,
Am a new user to Java world. I have a clarification on methods of Iterator interface. Iterator interface provides hasNext(), next() and remove() methods. From the Javadoc, class BeanContextSupport implements Iterator.
In collections like ArrayList, HashTable, HashSet, Vector we make use of those 3 methods to traverse through and remove objects. If you take ArrayList's hierarchy, I don't find BeanContextSupport in picture. In that case, which implementation does an ArrayList (or any collection) take for those 3 methods?
Thanks,
Maria
Hi Maria, I think you should
Hi Maria,
I think you should look at source code of AbstractList's iterator() method for your answer.
Iterator's implementation
The Iterator that you get out of an ArrayList with ArrayList.iterator() is an instance of AbstractList$Itr, which is a private class inside AbstractList. All this has nothing to do with BeanContextSupport.
The javadoc says BeanContextSupport implements Iterable, not Iterator. It's inherited in the following way:
BeanContextSupport implements BeanContext which extends Collection which extends Iterable.
The Iterable interface allows classes to be run inside a foreach statement. (Java 1.5)
Re:
This is a private class inside AbstractList. All this has nothing to do with BeanContextSupport.
Online school | Bachelor degrees | Online degrees
Re:
The Iterable interface allows classes to be run inside a foreach statement.
online Doctorate degrees | Applied Arts School
Re:
The Iterable interface allows classes to be run inside a foreach statement.
Online University
Post new comment