55 lines
730 B
Java
55 lines
730 B
Java
/**
|
|
* An item in a linked list.
|
|
*
|
|
* @author Marcus
|
|
*/
|
|
public class ListItem {
|
|
|
|
/**
|
|
* The value.
|
|
*/
|
|
private String value;
|
|
/**
|
|
* The next list item.
|
|
*/
|
|
private ListItem next;
|
|
|
|
/**
|
|
* Creates a list item with a value.
|
|
*
|
|
* @param value The value.
|
|
*/
|
|
public ListItem(String value) {
|
|
this.value = value;
|
|
}
|
|
|
|
/**
|
|
* Returns the value of the item.
|
|
*
|
|
* @return The value.
|
|
*/
|
|
public String getValue() {
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* Returns the next list item.
|
|
*
|
|
* @return The next list item.
|
|
*/
|
|
public ListItem getNext() {
|
|
return next;
|
|
}
|
|
|
|
/**
|
|
* Sets the next list item.
|
|
*
|
|
* @param next The next list item.
|
|
*/
|
|
public void setNext(ListItem next) {
|
|
this.next = next;
|
|
}
|
|
|
|
|
|
}
|