For this project, you will need to implement –
Expectations
Specifications
BasicDoubleLinkedList
This class only implementsthe next(), hasNext(), previous()and hasPrevious() methods ofthe ListIterator interface. (Follow javaAPI documentation of ListIterator interface forthe implementing these methods.)
The rest of the methods should throwthe UnsupportedOperationException, such as:
public void remove() throws UnsupportedOperationException{
throw new UnsupportedOperationException();
}Hint: You need at least oneattribute for this class that can be initialized to the head ofthe BasicDoubleLinkList in order to implementthe methods of this class.
All the entities are definedas protected so they can be accessed bythe subclass. Follow the Javadoc that is provided.
SortedDoubleLinkedList
A generic sorted double linked list will be constructed using aprovided Comparator to determine how the list isto be sorted.
Hint: define an attribute oftype Comparator and use it to compare the datain the list.
It extends BasicDoubleLinkedList class.The addToFront andthe addToEnd methods inheritedfrom the BasicDoubleLinkedList will not besupported. There will be an add method to inserta node in the sorted linked list dependening onthe Comparator. Follow the Javadoc that isprovided.
Exception Handling
GUI
A GUI driver has been provided for you to help you visualizeyour doubly-linked lists. Here is the minimum that must be in placeto start using the GUI driver effectively.
'''
BasicDoubleLinkedListTest
import static org.junit.Assert.*;
import java.util.ArrayList;import java.util.Comparator;import java.util.Iterator;import java.util.ListIterator;import java.util.NoSuchElementException;
import org.junit.After;import org.junit.Before;import org.junit.Test;
public class BasicDoubleLinkedListTest { It has the usual test cases along with what I putbelow. It must pass those test cases. private class Car{ String make; String model; int year; public Car(String make,String model, int year){ this.make= make; this.model= model; this.year= year; } public StringgetMake(){ returnmake; } public StringgetModel(){ returnmodel; } public int getYear(){ returnyear; } public String toString(){ return(getMake()+" "+getModel()+" "+getYear()); } }}
'''
For this project, you will need to implement – Expectations Specifications BasicDoubleLinkedList This class only impleme
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am