Answered step by step
Verified Expert Solution
Link Copied!

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:

image text in transcribed

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: CircularDoublyLinkedList public package abstract final protected private static Superclass: java.lang.Object Browse... Interfaces: edu.ics 211.04.IList211 java.lang.Iterable Add... Remove Which method stubs would you like to create? public static void main(String[] args) Constructors from superclass Inherited abstract methods Do you want to add comments? (Configure templates and default value here) Generate comments Cancel Finish 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: CircularDoublyLinkedList public package abstract final protected private static Superclass: java.lang.Object Browse... Interfaces: edu.ics 211.04.IList211 java.lang.Iterable Add... Remove Which method stubs would you like to create? public static void main(String[] args) Constructors from superclass Inherited abstract methods Do you want to add comments? (Configure templates and default value here) Generate comments Cancel Finish

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel 2024 In 7 Days

Authors: Alan Dinkins

1st Edition

B0CJ3X98XK, 979-8861224000

More Books

Students also viewed these Databases questions

Question

16.5 Autoregressive Integrated Moving Average Models

Answered: 1 week ago