-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSListNode.java
More file actions
35 lines (28 loc) · 828 Bytes
/
SListNode.java
File metadata and controls
35 lines (28 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* SListNode.java */
/**
* SListNode is a class used internally by the SList class. An SList object
* is a singly-linked list, and an SListNode is a node of a singly-linked
* list. Each SListNode has two references: one to an object, and one to
* the next node in the list.
*
* @author Kathy Yelick and Jonathan Shewchuk
*/
class SListNode {
Object item;
SListNode next;
/**
* SListNode() (with two parameters) constructs a list node referencing the
* item "obj", whose next list node is to be "next".
*/
SListNode(Object obj, SListNode next) {
item = obj;
this.next = next;
}
/**
* SListNode() (with one parameter) constructs a list node referencing the
* item "obj".
*/
SListNode(Object obj) {
this(obj, null);
}
}