Paul Clapham wrote:
Juan Bauer wrote:
You need to add the JUnit jar to the project's build path. None of the things you mentioned do that.
I did exactly that. As you can see on the screenshot the jar files are added to the project.
Does does look like it should?
Campbell Ritchie wrote:Well done
Juan Bauer wrote:. . . Alright got the first sort working!
But why isn't the datum field private? All fields should be private in normal programming, except those sued as global constants.
Campbell Ritchie wrote:Surely your parameter won't be type LocalTime? I think you should create a Comparator<Afspraak>, rather than making Afspraak implekent Comparable. But before doing anything, read this part of the Java™ Tutorials, and the links therein to Comparable and Comparator. After that you will know that Comparable objects are naturally ordered by a criterion, so I believe LocalDate and LocalTime will both implement Comparable. But an Afspraak doesn't have a criterion you can sort it by, but multiple criteria. In which case I think it is better to create a Comparator<Afspraak>, as Winston has already told you. This is the old way to do that sort of thing; if you look in the Java™ Tutorials again, you will find you can write a λ to shorten that code no end:-I have concocted a field naam which also implements Comparable<Naam>. I am sure you can alter that to use the beginTijd field instead, and you can also follow the examples in the first Java™ Tutorials link I showed you.
Carey Brown wrote:I think if you had clearer indenting you might have found this. Your toDoLijst.add() call is inside the loop. If the list is empty it will never get to any code inside the for() loop.