Search:

Type: Posts; User: Norm

Search: Search took 0.25 seconds.

  1. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    You save a value by assigning it to a variable.
  2. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    Where does the code save items from the list so they can be checked?
    For example this line prints out an item without saving it for checking:

    System.out.print("ID: [" + entry.getKey() + "] ...
  3. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    Are the 3s adjacent to each other in the list? After outputting one item from the list can you check the next item for equality and skip outputting it if it matches the last item output?

    Use...
  4. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    It is working now?
  5. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    Just talking about output for debugging purposes.
  6. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    The point is raw data without an id String can be hard to associate with the variable that held it.

    My entry printout: pE entry=cat=[2]
    your printout: [2]

    Your printout doesn't say what [2]...
  7. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    It's useful when printing variables to add an ID String to identify what is printed:

    System.out.println("wordMap="+wordMap);
    ...
    System.out.println("pE entry="+entry); //<<<<<<<<< pE...
  8. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    How can you get references to each of those objects so they can be compared?

    What printed when you used println() calls to show the following:
    What is in the collection: wordMap?
    What is in the...
  9. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    What objects are those in? You need object names to write code.

    Use println() calls to show the following:
    What is in the collection: wordMap?
    What is in the object: entry? The code only prints...
  10. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    What objects do you want to compare?

    What is in the collection: wordMap?
    What is in the object: entry? The code only prints part of it.
  11. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    This code makes not sense:

    if (!itr.equals(itr.next()))
    The two objects being compared are probably of different types.


    Print out the value of entry first thing in the printEntry() method to...
  12. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    Continue debugging to see what is happening to the data.
  13. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    Where is that iterator that has said that it had a next entry used in the printEntry() method?
    There is a new iterator created in the printEntry() method. That is the one to test.

    Add some...
  14. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    Basically the code should call hasNext() before calling next()
  15. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    Is there an element avaiable when the next() method is called on line 67? The code should test BEFORE calling next()
  16. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    Does it compile, execute and work correctly?


    I'm done for tonight. Back tomorrow.
  17. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    The posted code doesn't check for duplicates before adding a number to the list.

    lines.add(new Integer(lineNum));
  18. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    Is it ok to have duplicate line numbers in the list?
  19. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    Where does the code test for a duplicate entry?
  20. Replies
    42
    Views
    2,686

    Re: Presumably simple fix sets/maps

    Can you post the program's output that shows the problem, add some comments to the output describing what is wrong with it and show what it should be.
Results 1 to 20 of 20