(Solved) : Node Class Already Written Please Help Endlesslist Class S Methods Thank Much Node Class A Q41412292 . . .

The Node class has already written. Please help me with theendlesslist class’s methods. Thank you so much

////////////////////////////////////////////////////////////node class (already written)

public class Node<E> {

  
//fields
private Node prev;
private Node next;
private E value;
  
/**
* Constructor that sets prev and next to null.
*
* @param value the value to enter in this node
*/
public Node(E value) {
this.value = value;
}
  
/**
* Full constructor.
*
* @param value the value to enter in this node
* @param prev the node just before this one
* @param next the node just after this one
*/
public Node(E value, Node prev, Node next) {
this(value);
this.prev = prev;
this.next = next;
}

/**
* Provides access to the previous node.
*
* @return the previous node
*/
public Node getPrev() {
return prev;
}

/**
* Allows the previous node to be set.
*
* @param prev the previous node
*/
public void setPrev(Node prev) {
this.prev = prev;
}

/**
* Provides access to the next node.
*
* @return the next node
*/
public Node getNext() {
return next;
}

/**
* Allows the next node to be set.
*
* @param next the next node
*/
public void setNext(Node next) {
this.next = next;
}

/**
* Provides access to the value stored in this node
*
* @return the value
*/
public E getValue() {
return value;
}

/**
* Allows the value stored in this node to be set.
*
* @param value the value
*/
public void setValue(E value) {
this.value = value;
}
  
}

/////////////////////////////////////////////////////////////////////////////////////Endlesslistclass////////////////////

import java.util.Iterator;

/**
* This data class represents an ordered collection in an endlesscircular list.
*
* @param <E> the type of values stored in the list
* @author
*/
public class EndlessList<E> implements Iterable<E>{

//fields
private Node<E> cursor;

/**
* Adds a value before the current one and moves the cursor to thenew
* value. If the list is empty the value is simply added and becomesthe
* current one.
*
* @param value the value to add to the list
*/
public void addPrev(E value) {
// TODO write method body //
}

/**
* Adds a value after the current one and moves the cursor to thenew value.
* If the list is empty the value is simply added and becomes thecurrent
* one.
*
* @param value the value to add to the list
*/
public void addNext(E value) {
// TODO write method body //
}

/**
* Removes the current value from the list and moves the cursor tothe next
* value, returning the removed value. Returns a null if the list isempty.
* If this is the last value in the list the cursor becomesnull.
*
* @return the value removed
*/
public E remove() {
// TODO write method body //
return null;
}

/**
* Returns the value at the current cursor position. Returns a nullif the
* list is empty.
*
* @return the value
*/
public E getValue() {
// TODO write method body //
return null;
}

/**
* Changes the current value at the current cursor position. Returnsfalse
* if the list is empty and true if the change is made.
*
* @param value the new value
* @return true if successful, false if not
*/
public boolean setValue(E value) {
// TODO write method body //
return false;
}

/**
* Moves the cursor to the previous value in the list and returnsthat
* value. Returns a null if the list is empty.
*
* @return the value
*/
public E getPrev() {
// TODO write method body //
return null;
}

/**
* Moves the cursor to the next value in the list and returns thatvalue.
* Returns null if the list is empty.
*
* @return the value
*/
public E getNext() {
// TODO write method body //
return null;
}

/**
* Moves the cursor to the next occurrence of the given value,moving
* forward in the list. If the value is not found the cursor remainsat the
* same position in the list.
*
* @param value the value to search for
* @return true if the value is found, false if not
*/
public boolean moveToNext(E value) {
// TODO write method body //
return false;
}

/**
* Moves the cursor to the next occurrence of the given value,moving
* backwards in the list. If the value is not found the cursorremains at
* the same position in the list.
*
* @param value the value to search for
* @return true if the value is found, false if not
*/
public boolean moveToPrev(E value) {
// TODO write method body //
return false;
}

/**
* Provides and EndlessList iterator.
*
* @return the iterator
*/
@Override
public Iterator<E> iterator() {
return new EndlessListIterator();
}

/**
* Private class used to create an EndlessList iterator.
*/
private class EndlessListIterator implements Iterator<E>{

//fields
private Node<E> firstNode = cursor;
private boolean handledStart = false;

/**
* Reports if the current node has not been reported yet bycalling
* next(). Returns false if the list is empty.
*
* @return true if the current node has not been reported, false ifit
* has
*/
@Override
public boolean hasNext() {
// TODO write method body //
return false;
}

/**
* Returns the current value in the list and moves to thenext.
*
* @return the current value, or null if the list is empty
*/
@Override
public E next() {
// TODO write method body //
return null;
}

/**
* Removes the last value returned from next(). This assumes thatnext
* is called before each remove. If this is the only value in thelist
* the cursor becomes null.
*/
@Override
public void remove() {
// TODO write method body //
}

}

}

Expert Answer


Answer to The Node class has already written. Please help me with the endlesslist class’s methods. Thank you so much /////////////…