public class RoundList extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
private int |
cur |
private LinkedList |
l |
Constructor and Description |
---|
RoundList()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Object element)
Inserts the
element before the current element. |
boolean |
contains(Object element)
Returns true if this list contains the specified element.
|
Object |
get()
Returns the current
element in the list and updates the pointer
such that the current becomes the
next element in the list. |
Iterator |
iterator()
Returns an Iterator over the elements in this list.
|
static void |
main(String[] args)
Just for Debugging this implementation.
|
boolean |
remove(Object element)
Removes the first occurrence of the specified element in this list
and updates the pointer to the current element.
|
int |
size()
Returns the number of elements in this list.
|
Object[] |
toArray() |
String |
toString()
Returns a string representation of this collection.
|
private int cur
private LinkedList l
public boolean add(Object element)
element
before the current element.
If the list was empty, the inserted element becomes also the current element.
Note that this implementation uses a LinkedList
and therefore it is not synchronized.element
- the element to insertpublic Object get() throws NoSuchElementException
element
in the list and updates the pointer
such that the current becomes the
next element in the list.
size()
timesNoSuchElementException
- if the list is emptypublic boolean remove(Object element)
(element==null ? get(i)==null : element.equals(get(i)))
(if such an element exists).element
- the element to be removed from this list, if present.public boolean contains(Object element)
(element==null ? e==null : element.equals(e)).
element
- whose presence in this list is to be tested.public int size()
public Iterator iterator()
public Object[] toArray()
public String toString()
String.valueOf(Object).
public static void main(String[] args)