46 lines
801 B
Java
46 lines
801 B
Java
/**
|
|
* A simple linked list that stores strings.
|
|
*
|
|
* @author Marcus
|
|
*
|
|
*/
|
|
public class LinkedList {
|
|
|
|
/**
|
|
* The reference to the fist list element.
|
|
*/
|
|
private ListItem head;
|
|
|
|
/**
|
|
* Adds the value at the beginning of the list.
|
|
*
|
|
* @param value The value to add.
|
|
*/
|
|
public void prepend(String value) {
|
|
// TODO: implement
|
|
}
|
|
|
|
/**
|
|
* Returns the value at the specified index.
|
|
*
|
|
* @param index The index.
|
|
* @return The value at the index.
|
|
* @throws IllegalArgumentException Thrown if index < 0 or index > size() - 1.
|
|
*/
|
|
public String get(int index) {
|
|
// TODO: implement
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Returns the number of items that are in the list.
|
|
*
|
|
* @return The number of items in the list.
|
|
*/
|
|
public int size() {
|
|
// TODO: implement
|
|
return -1;
|
|
}
|
|
|
|
}
|