Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: iterator help needed

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default iterator help needed

    I have a generic linked list with an iterator(code below).

    public static void main(String[] args)
    	{
    		LinkedListStuff<String> myStuff = new LinkedListStuff<String>();
    		LinkedListStuff.listIterator myIterator = myStuff.iterator();
     
    		myList.addToStart("sports");
    		myList.addToStart("books");
    		myList.addToStart("hobbies");
    		...

    For some reason, I keep getting a "can't find symbol" error.

    Could someone point me in the right direction?

    Here's the error:

    LinkedListStuff3Demo.java:9: cannot find symbol
    symbol : method iterator()
    location: class LinkedListStuff<java.lang.String>
    LinkedListStuff.listIterator myIterator = myStuff.iterator();


    Thanks!


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: iterator help needed

    Well, is there a method called iterator() in LinkedListStuff? Or does it inherit it from a class it extends?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. The Following User Says Thank You to KevinWorkman For This Useful Post:

    999cm999 (March 29th, 2011)

  4. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: iterator help needed

    Oh....duh...sometimes you just need another pair of eyes to take a look! Thanks!

Similar Threads

  1. [SOLVED] Iterator next import class?
    By daydreamer in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 3rd, 2010, 04:51 AM
  2. [SOLVED] Help needed!
    By subhvi in forum Web Frameworks
    Replies: 4
    Last Post: February 18th, 2010, 09:26 AM
  3. Iterator Problem
    By chrisych in forum Algorithms & Recursion
    Replies: 2
    Last Post: February 10th, 2010, 01:29 PM
  4. [SOLVED] A little help needed..
    By JavaStudent87 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 22nd, 2010, 06:54 PM
  5. Iterator, with ArrayList
    By rsala004 in forum Collections and Generics
    Replies: 3
    Last Post: October 25th, 2009, 09:00 AM