Your *compareTo()* is causing the runtime error.
More specifically, your *compareTo()* does not satisfy the requirement.
check out
https://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html
For example, given two identical interval A and B
*compareTo(A, B)* should be *0* instead of *1*
A correct implementation of *compareTo()* is attached for your reference.
*@Override*
*public int compareTo(Interval o) {*
* if (this.time < o.time) {*
* return -1;*
* } else if (this.time > o.time) {*
* return 1;*
* } else if (this.isEnd && !o.isEnd) {*
* return -1;*
* } else if (!this.isEnd && o.isEnd) {*
* return 1;*
* } else {*
* return 0;*
* }*
*}*
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/f3a4cde2-e213-48c0-9622-e3738c60c621%40googlegroups.com.