SlideShare a Scribd company logo
How do I fix it in LinkedList.java?
LabProgram.java
LinkedList.java:
/**
* Defines a doubly-linked list class
* @author
* @author
*/
import java.util.NoSuchElementException;
public class LinkedList {
private class Node {
private T data;
private Node next;
private Node prev;
public Node(T data) {
this.data = data;
this.next = null;
this.prev = null;
}
}
private int length;
private Node first;
private Node last;
private Node iterator;
/**** CONSTRUCTORS ****/
/**
* Instantiates a new LinkedList with default values
* @postcondition
*/
public LinkedList() {
first = null;
last = null;
iterator = null;
length = 0;
}
/**
* Converts the given array into a LinkedList
* @param array the array of values to insert into this LinkedList
* @postcondition
*/
public LinkedList(T[] array) {
}
/**
* Instantiates a new LinkedList by copying another List
* @param original the LinkedList to copy
* @postcondition a new List object, which is an identical,
* but separate, copy of the LinkedList original
*/
public LinkedList(LinkedList original) {
}
/**** ACCESSORS ****/
public T getFirst() throws NoSuchElementException {
if (isEmpty()){
throw new NoSuchElementException("The list is empty");
}
return first.data;
}
public T getLast() throws NoSuchElementException {
if (isEmpty()){
throw new NoSuchElementException("The list is empty");
}
return last.data;
}
/**
* Returns the data stored in the iterator node
* @precondition
* @return the data stored in the iterator node
* @throw NullPointerException
*/
public T getIterator() throws NullPointerException {
if (iterator != null){
return iterator.data;
}else{
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/**
* Returns the current length of the LinkedList
* @return the length of the LinkedList from 0 to n
*/
public int getLength() {
return length;
}
/**
* Returns whether the LinkedList is currently empty
* @return whether the LinkedList is empty
*/
public boolean isEmpty() {
return length == 0;
}
/**
* Returns whether the iterator is offEnd, i.e. null
* @return whether the iterator is null
*/
public boolean offEnd() {
return iterator == null;
}
/**** MUTATORS ****/
public void addFirst(T data) {
Node newNode = new Node(data);
if(isEmpty()){
first = newNode;
last = newNode;
}
else{
newNode.next = first;
first.prev = newNode;
first = newNode;
}
length++;
}
public void addLast(T data) {
Node newNode = new Node(data);
if(isEmpty()){
first = newNode;
last = newNode;
}
else{
last.next = newNode;
newNode.prev = last;
last = newNode;
}
length++;
}
/**
* Inserts a new element after the iterator
* @param data the data to insert
* @precondition
* @throws NullPointerException
*/
public void addIterator(T data) throws NullPointerException{
if(iterator != null){
Node newNode = new Node(data);
newNode.next = iterator.next;
iterator.next = newNode;
if (iterator == first){
first = newNode;
}
}else{
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/
public void removeFirst() throws NoSuchElementException {
if(isEmpty()){
throw new NoSuchElementException("The list is empty");
}
if(length == 1){
first = null;
last = null;
iterator = null;
}
else{
if(iterator == first){
iterator = null;
}
first = first.next;
first.prev = null;
}
length--;
}
public void removeLast() throws NoSuchElementException {
if(isEmpty()){
throw new NoSuchElementException("The list is empty");
}
if(length == 1){
first = null;
last = null;
iterator = null;
}
else{
if(iterator == last){
iterator = null;
}
last = last.prev;
last.next = null;
}
length--;
}
/**
* removes the element referenced by the iterator
* @precondition
* @postcondition
* @throws NullPointerException
*/
public void removeIterator() throws NullPointerException {
if(iterator != null){
if(iterator == first){
first = first.next;
}else{
Node prev = first;
while(prev.next != iterator){
prev = prev.next;
}
prev.next = iterator.next;
if (iterator == last){
last = prev;
}
}
iterator = null;
}else {
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/**
* places the iterator at the first node
* @postcondition
*/
public void positionIterator(){
iterator = first;
}
/**
* Moves the iterator one node towards the last
* @precondition
* @postcondition
* @throws NullPointerException
*/
public void advanceIterator() throws NullPointerException {
if (!offEnd()){
iterator = iterator.next;
}else {
throw new NullPointerException("Iterator is off the end opf the list.");
}
}
/**
* Moves the iterator one node towards the first
* @precondition
* @postcondition
* @throws NullPointerException
*/
public void reverseIterator() throws NullPointerException {
if(iterator != first && iterator != null){
Node prev = first;
while (prev.next != iterator){
prev = prev.next;
}
iterator = prev;
}
}
public void clear() {
first = null;
last = null;
iterator = null;
length = 0;
}
public String toString() {
StringBuilder result = new StringBuilder();
Node temp = first;
while (temp != null){
result.append(temp.data + " ");
temp = temp.next;
}
return result.toString() + "n";
}
@SuppressWarnings("unchecked") //good practice to remove warning here
@Override
public boolean equals(Object obj) {
return false;
}
/**CHALLENGE METHODS*/
public void spinList(int numMoves) throws IllegalArgumentException{
}
public LinkedList altLists(LinkedList list) {
return null;
}
} java.lang.NullPointerException
Within your LinkedList class, see the field: private Node iterator; Notice that the iterator begins
at null, as defined by the LinkedList constructors. Take a moment now to update your default
constructor to set iterator = null; Also, look back at removefirst () and removeLast(). Consider
now what will happen if the iterator is at the first or last Node when these methods are called.
Update the methods to handle these edge cases now. We will develop additional methods during
this lab to work with the iterator. Remember to fill in the pre-and postconditions for each
method, as needed. Also inspect the LabProgram. java file and notice that the main () method of
the LabProgram creates a list of numbers and inserts each into a list. The main() method then
calls various iterator methods, displaying results of the method operation. Use Develop mode to
test your Linked List iterator code as you develop it. In Submit mode you will need to complete
all lab steps to pass all automatic tests. Step 2: Implement positionIterator() Method
positionIterator() moves the iterator to the beginning of the list. public void positionIterator() //
fill in here } public void positionIterator() ( // fill in here } Step 3: Implement offEnd() Method
offEnd () returns whether the iterator is off the end of the list, i.e. set to null. Step 4: Implement
getIterator() Method getIterator() returns the element in the Node where the iterator is currently
located. Step 5: Implement advanceIterator() Method advanceIterator () moves the iterator
forward by one node towards the last node. Step 6: Implement reverseIterator( ) Method
reverseIterator () moves the iterator back by one node towards the first node. Step 7: Implement
additerator() Method addIterator() inserts an element after the iterator. Step 8: Implement
removeIterator() Method removeIterator () removes the Node currently referenced by the iterator
and sets the iterator to null.
t java.util.scanner; c class LabProgram { ublic static void main(string[] args) { LabProgram lab
= new LabProgram(); // Make and display List LinkedList Integer list = new LinkedList >(); for
(int i=1;i<4;i++){ list. addLast (i); } System.out.print("Created list: " + list.tostring()); //
tostring() has system. out.println("list.offEnd(): " + list.offEnd()); system.out.println("list.
positionIterator()"); list.positionIterator(); system.out.println("list.offend(): " + list.offEnd());
system.out.println("list.getiterator(): " + list.getiterator ()); list.advanceiterator();
System.out.println("list.getiterator (): " + list.getiterator ());
system.out.println("list.advanceIterator ( )n); list.advanceIterator();
System.out.println("list.getiterator(): " + list.getiterator()); system.out.println("list.
reverseIterator ()n); list. reverseiterator(); System.out.println("list.getiterator(): " +
list.getiterator()); system.out.println("list.additerator (42)"); list.addIterator (42);
System.out.println("list.getiterator(): " + list.getiterator()); system.out.print "list. tostring(): " +
list.tostring()); system.out.println("list.advanceIterator ( )n); list. advanceiterator();
system.out.println("list.advanceIterator ( )n); list.advanceiterator();
System.out.println("list.additerator (99)"); list.additerator (99); system.out.print ("list. tostring():
" + list.tostring()); system.out.println("list.removeIterator()"); list.removerterator();
system.out.print ("list. tostring(): " + list.tostring()); system.out.println("list.offend(): " +
list.offend()); system.out.println("list. positionIterator()"); list. positionIterator();
system.out.println("list. removeIterator()"); list.removerterator();
system.out.println("list.offend(): " + list.offend()); system. out.print("list. tostring(): " +
list.tostring()); system.out.println("list. positionIterator()"); list.positioniterator();
system.out.println("list. advanceIterator ()"); list.advanceiterator();
system.out.println("list.advanceIterator ( ()"); list.advanceiterator(); system.out.println("list.
removeIterator()"); list. removerterator(); system.out.print("list. tostring(): " + list.tostring());

More Related Content

PDF
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
PDF
How do I fix it in LinkedList.javaLinkedList.java Define.pdf
PDF
How do I fix it in javaLinkedList.java Defines a doubl.pdf
PDF
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
PDF
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdf
PDF
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
PDF
I keep getting NullPointerExcepetion, can someone help me with spinL.pdf
PDF
File LinkedList.java Defines a doubly-l.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javaLinkedList.java Define.pdf
How do I fix it in javaLinkedList.java Defines a doubl.pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
Copy your completed LinkedList class from Lab 3 into the LinkedList..pdf
Labprogram.javaLinkedList.javaimport java.util.NoSuchElementEx.pdf
I keep getting NullPointerExcepetion, can someone help me with spinL.pdf
File LinkedList.java Defines a doubly-l.pdf

Similar to How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf (20)

PDF
Class DiagramIn the Assignment #10, you are given three files Ass.pdf
PDF
Hi,I have added the methods and main class as per your requirement.pdf
PDF
Fix my codeCode.pdf
PDF
please i need help Im writing a program to test the merge sort alg.pdf
PDF
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
DOCX
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
PDF
Implementation The starter code includes List.java. You should not c.pdf
PDF
import java-util--- public class MyLinkedList{ public static void.pdf
PDF
Note             Given Code modified as required and required met.pdf
PDF
Given below is the completed implementation of MyLinkedList class. O.pdf
PDF
Please help me to make a programming project I have to sue them today- (1).pdf
PDF
import java.util.Iterator; import java.util.NoSuchElementException; .pdf
PDF
public class MyLinkedListltE extends ComparableltEgtg.pdf
PDF
To complete the task, you need to fill in the missing code. I’ve inc.pdf
PDF
This is problem is same problem which i submitted on 22017, I just.pdf
DOCX
Please complete all the code as per instructions in Java programming.docx
PPT
Jhtp5 20 Datastructures
PDF
hi i have to write a java program involving link lists. i have a pro.pdf
PDF
STAGE 2 The Methods 65 points Implement all the methods t.pdf
PDF
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
Class DiagramIn the Assignment #10, you are given three files Ass.pdf
Hi,I have added the methods and main class as per your requirement.pdf
Fix my codeCode.pdf
please i need help Im writing a program to test the merge sort alg.pdf
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
Implementation The starter code includes List.java. You should not c.pdf
import java-util--- public class MyLinkedList{ public static void.pdf
Note             Given Code modified as required and required met.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
Please help me to make a programming project I have to sue them today- (1).pdf
import java.util.Iterator; import java.util.NoSuchElementException; .pdf
public class MyLinkedListltE extends ComparableltEgtg.pdf
To complete the task, you need to fill in the missing code. I’ve inc.pdf
This is problem is same problem which i submitted on 22017, I just.pdf
Please complete all the code as per instructions in Java programming.docx
Jhtp5 20 Datastructures
hi i have to write a java program involving link lists. i have a pro.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdf
Implement the additional 5 methods as indicated in the LinkedList fi.pdf
Ad

More from mail931892 (12)

PDF
I need help writing test Codepackage org.example;import j.pdf
PDF
I need help on this 5 and 6. here is the code so far import jav.pdf
PDF
I need a substantive comment on this postThe formal structure of .pdf
PDF
I need help debugging some code. I am trying to read a text file and.pdf
PDF
I have these files in picture I wrote most the codes but I stuck wit.pdf
PDF
I am trying to create a dynamic web project in Eclipse IDE that impl.pdf
PDF
how can i build this as problem 2 of my code #include iostream.pdf
PDF
Hi All!I have a question regrading creating a subgraph or rather v.pdf
PDF
HeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdf
PDF
Help I keep getting the same error when running a code. Below is the.pdf
PDF
For this part you will need to analyze the provided logfile part2.lo.pdf
PDF
Ginny (45) is unmarried. Who of the following may be Ginnys quali.pdf
I need help writing test Codepackage org.example;import j.pdf
I need help on this 5 and 6. here is the code so far import jav.pdf
I need a substantive comment on this postThe formal structure of .pdf
I need help debugging some code. I am trying to read a text file and.pdf
I have these files in picture I wrote most the codes but I stuck wit.pdf
I am trying to create a dynamic web project in Eclipse IDE that impl.pdf
how can i build this as problem 2 of my code #include iostream.pdf
Hi All!I have a question regrading creating a subgraph or rather v.pdf
HeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdf
Help I keep getting the same error when running a code. Below is the.pdf
For this part you will need to analyze the provided logfile part2.lo.pdf
Ginny (45) is unmarried. Who of the following may be Ginnys quali.pdf
Ad

Recently uploaded (20)

PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Pre independence Education in Inndia.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
master seminar digital applications in india
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Computing-Curriculum for Schools in Ghana
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Lesson notes of climatology university.
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Institutional Correction lecture only . . .
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Supply Chain Operations Speaking Notes -ICLT Program
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Pre independence Education in Inndia.pdf
Cell Structure & Organelles in detailed.
Microbial disease of the cardiovascular and lymphatic systems
Pharmacology of Heart Failure /Pharmacotherapy of CHF
master seminar digital applications in india
O7-L3 Supply Chain Operations - ICLT Program
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
Computing-Curriculum for Schools in Ghana
VCE English Exam - Section C Student Revision Booklet
Sports Quiz easy sports quiz sports quiz
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Microbial diseases, their pathogenesis and prophylaxis
Lesson notes of climatology university.
Abdominal Access Techniques with Prof. Dr. R K Mishra
Institutional Correction lecture only . . .
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf

How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf

  • 1. How do I fix it in LinkedList.java? LabProgram.java LinkedList.java: /** * Defines a doubly-linked list class * @author * @author */ import java.util.NoSuchElementException; public class LinkedList { private class Node { private T data; private Node next; private Node prev; public Node(T data) { this.data = data; this.next = null; this.prev = null; } } private int length; private Node first; private Node last; private Node iterator; /**** CONSTRUCTORS ****/ /** * Instantiates a new LinkedList with default values * @postcondition */ public LinkedList() { first = null; last = null; iterator = null; length = 0;
  • 2. } /** * Converts the given array into a LinkedList * @param array the array of values to insert into this LinkedList * @postcondition */ public LinkedList(T[] array) { } /** * Instantiates a new LinkedList by copying another List * @param original the LinkedList to copy * @postcondition a new List object, which is an identical, * but separate, copy of the LinkedList original */ public LinkedList(LinkedList original) { } /**** ACCESSORS ****/ public T getFirst() throws NoSuchElementException { if (isEmpty()){ throw new NoSuchElementException("The list is empty"); } return first.data; } public T getLast() throws NoSuchElementException { if (isEmpty()){ throw new NoSuchElementException("The list is empty"); } return last.data; }
  • 3. /** * Returns the data stored in the iterator node * @precondition * @return the data stored in the iterator node * @throw NullPointerException */ public T getIterator() throws NullPointerException { if (iterator != null){ return iterator.data; }else{ throw new NullPointerException("Iterator is off the end opf the list."); } } /** * Returns the current length of the LinkedList * @return the length of the LinkedList from 0 to n */ public int getLength() { return length; } /** * Returns whether the LinkedList is currently empty * @return whether the LinkedList is empty */ public boolean isEmpty() { return length == 0; } /** * Returns whether the iterator is offEnd, i.e. null * @return whether the iterator is null */
  • 4. public boolean offEnd() { return iterator == null; } /**** MUTATORS ****/ public void addFirst(T data) { Node newNode = new Node(data); if(isEmpty()){ first = newNode; last = newNode; } else{ newNode.next = first; first.prev = newNode; first = newNode; } length++; } public void addLast(T data) { Node newNode = new Node(data); if(isEmpty()){ first = newNode; last = newNode; } else{ last.next = newNode;
  • 5. newNode.prev = last; last = newNode; } length++; } /** * Inserts a new element after the iterator * @param data the data to insert * @precondition * @throws NullPointerException */ public void addIterator(T data) throws NullPointerException{ if(iterator != null){ Node newNode = new Node(data); newNode.next = iterator.next; iterator.next = newNode; if (iterator == first){ first = newNode; } }else{ throw new NullPointerException("Iterator is off the end opf the list."); } } / public void removeFirst() throws NoSuchElementException { if(isEmpty()){ throw new NoSuchElementException("The list is empty"); }
  • 6. if(length == 1){ first = null; last = null; iterator = null; } else{ if(iterator == first){ iterator = null; } first = first.next; first.prev = null; } length--; } public void removeLast() throws NoSuchElementException { if(isEmpty()){ throw new NoSuchElementException("The list is empty"); } if(length == 1){ first = null; last = null; iterator = null; } else{ if(iterator == last){ iterator = null; } last = last.prev; last.next = null; } length--; }
  • 7. /** * removes the element referenced by the iterator * @precondition * @postcondition * @throws NullPointerException */ public void removeIterator() throws NullPointerException { if(iterator != null){ if(iterator == first){ first = first.next; }else{ Node prev = first; while(prev.next != iterator){ prev = prev.next; } prev.next = iterator.next; if (iterator == last){ last = prev; } } iterator = null; }else { throw new NullPointerException("Iterator is off the end opf the list."); } } /**
  • 8. * places the iterator at the first node * @postcondition */ public void positionIterator(){ iterator = first; } /** * Moves the iterator one node towards the last * @precondition * @postcondition * @throws NullPointerException */ public void advanceIterator() throws NullPointerException { if (!offEnd()){ iterator = iterator.next; }else { throw new NullPointerException("Iterator is off the end opf the list."); } } /** * Moves the iterator one node towards the first * @precondition * @postcondition * @throws NullPointerException */ public void reverseIterator() throws NullPointerException { if(iterator != first && iterator != null){ Node prev = first;
  • 9. while (prev.next != iterator){ prev = prev.next; } iterator = prev; } } public void clear() { first = null; last = null; iterator = null; length = 0; } public String toString() { StringBuilder result = new StringBuilder(); Node temp = first; while (temp != null){ result.append(temp.data + " "); temp = temp.next; } return result.toString() + "n"; }
  • 10. @SuppressWarnings("unchecked") //good practice to remove warning here @Override public boolean equals(Object obj) { return false; } /**CHALLENGE METHODS*/ public void spinList(int numMoves) throws IllegalArgumentException{ } public LinkedList altLists(LinkedList list) { return null; } } java.lang.NullPointerException Within your LinkedList class, see the field: private Node iterator; Notice that the iterator begins at null, as defined by the LinkedList constructors. Take a moment now to update your default constructor to set iterator = null; Also, look back at removefirst () and removeLast(). Consider now what will happen if the iterator is at the first or last Node when these methods are called. Update the methods to handle these edge cases now. We will develop additional methods during this lab to work with the iterator. Remember to fill in the pre-and postconditions for each method, as needed. Also inspect the LabProgram. java file and notice that the main () method of the LabProgram creates a list of numbers and inserts each into a list. The main() method then calls various iterator methods, displaying results of the method operation. Use Develop mode to test your Linked List iterator code as you develop it. In Submit mode you will need to complete all lab steps to pass all automatic tests. Step 2: Implement positionIterator() Method positionIterator() moves the iterator to the beginning of the list. public void positionIterator() // fill in here } public void positionIterator() ( // fill in here } Step 3: Implement offEnd() Method offEnd () returns whether the iterator is off the end of the list, i.e. set to null. Step 4: Implement getIterator() Method getIterator() returns the element in the Node where the iterator is currently located. Step 5: Implement advanceIterator() Method advanceIterator () moves the iterator
  • 11. forward by one node towards the last node. Step 6: Implement reverseIterator( ) Method reverseIterator () moves the iterator back by one node towards the first node. Step 7: Implement additerator() Method addIterator() inserts an element after the iterator. Step 8: Implement removeIterator() Method removeIterator () removes the Node currently referenced by the iterator and sets the iterator to null. t java.util.scanner; c class LabProgram { ublic static void main(string[] args) { LabProgram lab = new LabProgram(); // Make and display List LinkedList Integer list = new LinkedList >(); for (int i=1;i<4;i++){ list. addLast (i); } System.out.print("Created list: " + list.tostring()); // tostring() has system. out.println("list.offEnd(): " + list.offEnd()); system.out.println("list. positionIterator()"); list.positionIterator(); system.out.println("list.offend(): " + list.offEnd()); system.out.println("list.getiterator(): " + list.getiterator ()); list.advanceiterator(); System.out.println("list.getiterator (): " + list.getiterator ()); system.out.println("list.advanceIterator ( )n); list.advanceIterator(); System.out.println("list.getiterator(): " + list.getiterator()); system.out.println("list. reverseIterator ()n); list. reverseiterator(); System.out.println("list.getiterator(): " + list.getiterator()); system.out.println("list.additerator (42)"); list.addIterator (42); System.out.println("list.getiterator(): " + list.getiterator()); system.out.print "list. tostring(): " + list.tostring()); system.out.println("list.advanceIterator ( )n); list. advanceiterator(); system.out.println("list.advanceIterator ( )n); list.advanceiterator(); System.out.println("list.additerator (99)"); list.additerator (99); system.out.print ("list. tostring(): " + list.tostring()); system.out.println("list.removeIterator()"); list.removerterator(); system.out.print ("list. tostring(): " + list.tostring()); system.out.println("list.offend(): " + list.offend()); system.out.println("list. positionIterator()"); list. positionIterator(); system.out.println("list. removeIterator()"); list.removerterator(); system.out.println("list.offend(): " + list.offend()); system. out.print("list. tostring(): " + list.tostring()); system.out.println("list. positionIterator()"); list.positioniterator(); system.out.println("list. advanceIterator ()"); list.advanceiterator(); system.out.println("list.advanceIterator ( ()"); list.advanceiterator(); system.out.println("list. removeIterator()"); list. removerterator(); system.out.print("list. tostring(): " + list.tostring());