Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class IterativeLinkedList<T> {
- private T value;
- private IterativeLinkedList<T> next;
- public IterativeLinkedList<T> getNext() {
- return next;
- }
- public IterativeLinkedList(T value, IterativeLinkedList<T> next) {
- super();
- this.value = value;
- this.next = next;
- }
- public IterativeLinkedList(T value) {
- super();
- this.value = value;
- }
- public void setNext(IterativeLinkedList<T> next) {
- this.next = next;
- }
- public T getValue() {
- return value;
- }
- public void setValue(T value) {
- this.value = value;
- }
- public T first() {
- return this.getValue();
- }
- public T second() {
- if(this.getNext() != null)
- {
- return this.getNext().getValue();
- }
- else
- {
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement