DIFFERENCE BETWEEN ITERATOR AND iterator( )
Can someone tell me whats the difference between ITERATOR and iterator( ) ?
Is iterator( ) method present in Class ArrayList or is it present in List interface or is it present in ITERATOR interface?
And what is ITERATOR interface.....is this a sub interface of LIST interface?
Class ArrayList implements this ITERATOR interface?
Also what are we doing b y the following code where arr is an object of Class Arraylist
ListIterator<String> litarr = arr.listIterator();
Re: DIFFERENCE BETWEEN ITERATOR AND iterator( )
There is no ITERATOR interface.
There is an Iterator interface however.
Anyway, the iterator() method returns an Iterator<whatever class> from the Collection<whatever class> it is called on.
SO one is a method that returns an object that implements the other.