If that line is indeed the root cause of the NPE then comp, which I assume is a reference to the Comparator, must be null, as head can't be null at that point unless you add multi-threading to the mix. That is of course if that line is indeed the root cause of the NPE and it isn't thrown somewhere from inside the compare() method.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Paul Clapham wrote:Then either the "head" variable is null, or the "comp" variable is null. As far as I can see there, either of those could be the case.
comp was null....
Beware the other head of science - it bites! Nibble on this message:
a bit of art, as a gift, that will fit in a stocking