Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132939 views
License: OTHER
1
public class Node {
2
// Usually you would use "Generics" at this point to be able
3
// to hold arbitrary Objects, not only Bikes.
4
private final Bike element;
5
private Node next;
6
7
/**
8
* Constructor.
9
*
10
* @param element the element you want to add
11
*/
12
public Node(Bike element) {
13
this.element = element;
14
}
15
16
/**
17
* Getter for the content of this node.
18
*
19
* @return the element
20
*/
21
public Bike getElement() {
22
return element;
23
}
24
25
/**
26
* @return the next
27
*/
28
public Node getNext() {
29
return next;
30
}
31
32
/**
33
* @param next the next to set
34
*/
35
public void setNext(Node next) {
36
this.next = next;
37
}
38
39
/*
40
* (non-Javadoc)
41
*
42
* @see java.lang.Object#toString()
43
*/
44
@Override
45
public String toString() {
46
return "Node[element=" + element + "]";
47
}
48
}
49
50