Modifier and Type | Field and Description |
---|---|
protected LLCell |
head |
protected int |
length |
protected LLCell |
tail |
Constructor and Description |
---|
LList() |
Modifier and Type | Method and Description |
---|---|
void |
add(Object o)
Add an object to the end of the list.
|
void |
append(Object o)
Append an object to the end of the list.
|
protected Object |
deleteHead()
Delete the object at the head of the list.
|
Object |
elementAt(int i)
Get the ith element in the list.
|
Enumeration |
elements()
Return an enumeration of the list elements
|
int |
height()
How high is the stack?
|
boolean |
includes(Object o)
Answers whether or not an object is contained in the list
|
protected void |
insertHead(Object o)
Insert an object at the head of the list.
|
int |
length()
Return the length of the list.
|
Object |
pop()
Pop the top element of the stack off.
|
void |
push(Object o)
Push an object onto the stack.
|
Object |
top() |
public void add(Object o)
public void append(Object o)
protected Object deleteHead() throws NoSuchElementException
NoSuchElementException
- if the list is empty.public Object elementAt(int i) throws NoSuchElementException
elementAt
in interface List
i
- the index (from 0) of the requested element.NoSuchElementException
public Enumeration elements()
public boolean includes(Object o)
protected void insertHead(Object o)
o
- the object to addpublic Object pop() throws NoSuchElementException
pop
in interface Stack
NoSuchElementException
- if the stack is empty.public void push(Object o)
public Object top() throws NoSuchElementException
top
in interface Stack
NoSuchElementException