Search:

Type: Posts; User: Norm

Search: Search took 0.10 seconds.

  1. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    Glad you got it working.
  2. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    Have you worked through the logic of what the code is doing? Play computer with it and see what it does.
    Why do you expect it to go through the list more than once?
  3. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    For solving these kinds of problems you must use paper and pencil and work through your logic. In the code add enough printlns to see what is happening and then compare it with what you have worked...
  4. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    One thing I see is that you are printlng out the values that are being tested: if(dateCheck.before(date))

    For solving these kinds of problems you must use paper and pencil and work through your...
  5. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    You need to post the code that shows the logic and that can be executed for testing.
  6. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    The code loses the first element and has two copies of the 3rd.
    Time for some design work with a paper and pencil.
  7. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    I changed the debug print out to give more info:



    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.LinkedList;
    import...
  8. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    I see two dates. Which date is it supposed to sort on?
  9. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    Can you make a small simple program that compiles and execute and shows the problem. Hardcode the data into the program so no extra files are required.
  10. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    How can I test it?
  11. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    hasNext() will stay true until you remove all the items from the iterator.
  12. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    Now you need to print out the values of the variables that are causing the infinite loop Then try to see why the code does not change them to allow the loop to exit.
  13. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    Let us know when you have working code to test.
    Or try debugging the code yourself. If you don't use an interactive debugger, add lots of println statements to show execution flow and the values of...
  14. Replies
    28
    Views
    3,851

    [SOLVED] Re: Sorting LinkedList

    Can you print out the list before the sort and again after the sort to show what the code is doing?
Results 1 to 14 of 14