Results 1 to 2 of 2
  1. #1
    mark clarke is offline Member
    Join Date
    Aug 2011
    Posts
    2
    Rep Power
    0

    Default 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();

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,931
    Rep Power
    19

    Default 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.

Similar Threads

  1. iterator
    By TopNFalvors in forum New To Java
    Replies: 3
    Last Post: 03-29-2011, 02:34 PM
  2. Iterator
    By Dayanand in forum New To Java
    Replies: 2
    Last Post: 03-10-2011, 12:17 PM
  3. Replies: 0
    Last Post: 05-18-2010, 12:53 AM
  4. Iterator help
    By alpdog14 in forum New To Java
    Replies: 2
    Last Post: 10-13-2009, 08:42 PM
  5. Iterator
    By eva in forum New To Java
    Replies: 0
    Last Post: 01-31-2008, 02:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •