t**d 发帖数: 352 | 1 what can be all all possible cases? all u,t, u,next() and t.next() have to
be not null, otherwise this function has no meaning.
so
if (t == null || u == null ) throw new NullPointerException();
if (t == u) return;
linkedList tnext = t.next();
linkedList unext = u.next();
if (tnext == null || unext == null ) throw new NullPointerException();
t._next = unext;
u._next = tnext;
linkedList temp = tnext.next();
tnext._next = unext.next();
unext._next = temp; |
|