由买买提看人间百态

topics

全部话题 - 话题: tnext
(共0页)
t**d
发帖数: 352
1
来自主题: JobHunting版 - linklist exercise
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;
(共0页)