Results 1 to 2 of 2
  1. #1
    JeanNoel 53 is offline Member
    Join Date
    Dec 2010
    Rep Power

    Smile Some problems with java

    I have did lot of C++ before starting java
    and i am converting a c++ program to java
    the program use lot of list operations
    the first problem i have is no it-- is available
    in a list you can need to backtrack the Iterator
    I only found next() as operation on an Iterator
    does'it exist a previous() function
    if no is it possible to add it?
    have you any experience in this topic?

  2. #2
    user0 is offline Senior Member
    Join Date
    Dec 2010
    Rep Power


    Generally speaking, the Iterator<E> class does not support backward iteration. However, since you are using lists, try experimenting with ListIterator<E> instead. This has a hasPrevious() and previous() method. A ListIterator<E> extends Interator<E> but also enables you to traverse the list in either direction.

    Hope that helps!

Similar Threads

  1. java problems
    By p595285902 in forum New To Java
    Replies: 6
    Last Post: 11-28-2010, 10:55 PM
  2. Weird java problems
    By debylni in forum Advanced Java
    Replies: 5
    Last Post: 03-10-2010, 02:17 PM
  3. Replies: 2
    Last Post: 01-16-2010, 04:50 PM
  4. Java Problems
    By xonkie in forum New To Java
    Replies: 6
    Last Post: 12-03-2008, 07:14 PM
  5. Please help me solve these Java Problems
    By saculellav in forum New To Java
    Replies: 7
    Last Post: 07-27-2008, 11:58 AM

Tags for this Thread

Posting Permissions

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