Java Reference
In-Depth Information
public
LinkedChainBase()
{
clear();
}
// end default constructor
<
Implementations of the public methods
clear
,
getLength
,
isEmpty
,
and
toArray
go here.
>
. . .
<
Implementations of the protected methods
getNodeAt
,
getFirstNode
,
addFirstNode
,
addAfterNode
,
removeFirstNode
,
and
removeAfterNode
go here. >
. . .
protected class
Node
{
private
T data;
// data portion
private
Node next;
// next to next node
protected
Node(T dataPortion)
{
data = dataPortion;
next =
null
;
}
// end constructor
private
Node(T dataPortion, Node nextNode)
{
data = dataPortion;
next = nextNode;
}
// end constructor
<
Implementations of the protected methods
getData
,
setData
,
and
getNextNode
go here.
>
. . .
<
Implementation of the private method
setNextNode
goes here. >
. . .
}
// end Node
}
// end LinkedChainBase
17.11
We can now revise the class
LListRevised
, as shown in Listing 17-3.
LISTING 17-3
A revision of
LListRevised
that extends
LinkedChainBase
public class
LListRevised<T>
extends
LinkedChainBase<T>
implements
ListInterface<T>
{