Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA - Circular Doubly Linked List Does anybody could help me with this method below ( SET) ? Remember it's a circular linked list public
JAVA - Circular Doubly Linked List
Does anybody could help me with this method below (SET)? Remember it's a circular linked list
public void set(E arg0) { // code here }
EXPLANATION
We have this class with these two implemented inferfaces:
The interfaces are:
package edu.ics211.h04; /** * Interface for a List211. * * @author Cam Moore * @param the generic type of the Lists. */ public interface IList211 { /** * Gets the item at the given index. * @param index the index. * @return the item at the given index. */ E get(int index); /** * Sets the item at the given index. * @param index the index. * @param element the new element to set. * @return the old element at index. */ E set(int index, E element); /** * Returns the index of the given obj or -1. * @param obj the object to find. * @return the index of the given obj or -1. */ int indexOf(Object obj); /** * Returns the size of this list. * @return the size of this list. */ int size(); /** * Adds e to the end of the list. * @param e the item to add. * @return true if successful, false otherwise. */ boolean add(E e); /** * Adds element to the list at the given index. * @param index the index. * @param element the element to add. */ void add(int index, E element); /** * Removes the element at the given index. * @param index the index. * @return The element removed from the list. */ E remove(int index); }
Inside CircularDoublyLinkedList we have another class that implements
public interface ListIterator { void add(E e); // Inserts the specified element to the list. (Optional for this assignment) boolean hasNext(); // Returns true if this list iterator has more elements while traversing in the forward direction. boolean hasPrevious(); // Returns true if this list iterator has more elements while traversing in the reverse direction. E next(); // Returns the next Element. int nextIndex(); // Returns the index of the next element. E previous(); // Returns the previous Element int previousIndex(); // Returns the index of the previous element. void remove(); // Removes from the list the last element that was returned. void set(E e); // Replaces the last element returned. (Optional for this assignment) }
Thank you very much for your help!!
New Java Class Java Class Create a new Java class. Source folder: cmoore/src Browse... Package: edu.ics 211.h06 Browse... Enclosing type: Browse... Name: Modifiers: CircularDoublyLinkedListStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started