SlideShare a Scribd company logo
1 of 4
Download to read offline
Please and Thank you
Objective: The purpose of this exercise is to create a Linked List data structure that mimics the
behavior of the Java Standard Library Version (Java API). The outcomes/results of using the
library features should be identical with your own version (My API). However, the underlying
implementation should follow with the descriptions listed below.
Instructions : Create the following Linked List Data Structure with the given description below
in your utils package and use "for loops" for your repetitive tasks.
Where to find starter code in my-api
package.class : utils.LinkedList
package.class : tests.console.week04.LinkedListTest
Where to find your JUNIT test in my-api
package.class : tests.junit.LinkedListJUnitTest
Nested Class that has to be added to LinkedList class
package.class : utils.LinkedList.Node
Task Check List
ONLY "for" loops should be used within the data structure class. There is an automatic 30%
deduction, if other loops are used.
The names of identifiers MUST match the names listed in the description below. Deductions
otherwise.
Complete coding Assignment in your "my-api" GitHub Repository. You will not be graded
otherwise and will receive a 0, if not uploaded there.
Run JUNIT TEST and take a SNAPSHOT of results. Upload PDF of snapshot of your JUnitTest
results to Canvas.
Description
The internal structure of the Linked List is a doubly linked Node data structure and should have
at a minimum the following specifications:
data fields: The data fields to declare are private and you will keep track of the size of the list
with the variable size and the start of the list with the reference variable data.
first is a reference variable for the first Node in the list.
last is a reference variable for the last Node in the list.
size keeps track of the number of nodes in the list of type int. This will allow you to know the
current size of the list without having to traversing the list.
constructors: The overloaded constructors will initialize the data fields size and data.
A constructor that is a default constructor initializes the starting node location first and size to a
zero equivalent, that is, constructs an empty list.
methods: methods that manages the behavior of the linked nodes.
Together, the methods below give the illusion of a index or countable location. Implement these
methods within your generic Linked List class.
Method
Description
Header
public boolean add(E item)
public void add(int index, E item)
public void append( E item)
private void checkIndex(int index)
public boolean contains(E item)
public void clear()
private E detach(int index)
public E get(int index)
public int indexOf(E item)
private void insertBefore(int index, E item)
public boolean isEmpty()
private Node node(int index)
public E remove(int index)
public boolean remove(E item)
public E set(int index, E item)
public int size()
public String toString()
Node Data Structure
The generic Linked List class includes a static Node class as a nested class, i.e. a static inner
class within the Linked List class.
inner class: class inside the body of another class.
Note: This private class does not require access to instance members of the outer class, so it is
declared static. This means that the node object wont be coupled to the outer class object, thus
will be more optimal since it wont require heap/stack memory.
data fields:
data : hold the data stored in each node as is of type E.
next : stores the location of the next node in the list.
prev : stores the location of the previous node in the list.
constructor:
A constructor that receives parameters for data, and prev and calls the second constructor.
public Node(Node prev, E data)
A constructor that receives parameters for data, next and prev.
public Node(Node prev, E data, Node next)
Method
Description
Header add(item)uses the append method and ensures that there is enough spaces to store each
element in the list. Also updates the number of elements in the list by one. This method returns
true, if the data was added successfully.
public boolean add(E item) add(index, item)inserts elements at a given location in the list,
shifting subsequent elements to the right. Uses the append and insertBefore methods to assist
with adding items to the front, back and middle of the list. Updates the number of elements in the
list by one.
public void add(int index, E item) append(item)appends elements to the end of the list, but does
not update the number of elements. This is a private helper method.
public void append( E item) checkIndex(index)checks if the given index is valid. Validation
means that you cannot access indexes where elements have not been placed. Throws an
IndexOutOfBoundsException, if invalid. This is a private helper method.
private void checkIndex(int index) contains(item)searches for a specific item within the linked
structure and returns true, if the item is in the list.
public boolean contains(E item) clear()clears list of all elements, returns size back to zero.
public void clear() detach(index)detaches the node at the specified index from list and returns
the deleted element, but does not reduce the size of the list. This is a private helper method.
private E detach(int index) get(index)returns the item at the specified position in the list. This
method first checks if the index requested is valid.
public E get(int index) indexOf(item)searches for a specific item within the linked structure and
returns the first occurrence (i.e. index location) in the list, otherwise returns -1, if NOT found.
public int indexOf(E item) insertBefore(index, item)inserts an item before the non-null node at
the specified index in the list. Traverses the list to find this node. This method also checks for
insertions at the start and end of the list, as well as when empty. This is a private helper method.
private void insertBefore(int index, E item) isEmpty()returns true, if the list is empty, i.e., the
list contains no elements.
public boolean isEmpty() node(index)returns a reference to the node at the given position in the
list. This node traverses the list in two directions from front to middle and back to middle. This is
a private helper method.
private Node node(int index) remove(index)removes the item at the given position in the list for
a valid index. Checks for valid index before it proceeds with removal. Shifts subsequent
elements to the left and returns the item removed. The number of elements in the list is reduced
by one.
public E remove(int index) remove(item)removes the first occurrence of the specified item from
the list, if present. Shifts subsequent elements to the left and returns true, if the item is removed.
The number of elements in the list is reduced by one.
public boolean remove(E item) set(index, item)replaces the item at the specified position with
the one passed. This method checks if the index requested is valid before it does the replacement
and returns the replaced item.
public E set(int index, E item)size()returns the number of elements in the list.
public int size()toString()displays the contents of the list according to the same format at shown
in the Java API.
public String toString()

More Related Content

Similar to Please and Thank youObjective The purpose of this exercise is to .pdf

Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - JavaDrishti Bhalla
 
Implementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdfImplementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdfmaheshkumar12354
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)swajahatr
 
Built-in Data Structures in python 3.pdf
Built-in Data Structures in python 3.pdfBuilt-in Data Structures in python 3.pdf
Built-in Data Structures in python 3.pdfalivaisi1
 
List Data Structure
List Data StructureList Data Structure
List Data StructureZidny Nafan
 
There are a couple of new methods that you will be writing for this pr.pdf
There are a couple of new methods that you will be writing for this pr.pdfThere are a couple of new methods that you will be writing for this pr.pdf
There are a couple of new methods that you will be writing for this pr.pdfaamousnowov
 
Part B- Implementing a Sorted Linked list The class declarations has b.pdf
Part B- Implementing a Sorted Linked list The class declarations has b.pdfPart B- Implementing a Sorted Linked list The class declarations has b.pdf
Part B- Implementing a Sorted Linked list The class declarations has b.pdfinfo571050
 
oop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionoop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionssuseredfbe9
 
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
 The MyLinkedList class used in Listing 24.6 is a one-way directional .docx The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
The MyLinkedList class used in Listing 24.6 is a one-way directional .docxKomlin1
 
Linked list (java platform se 8 )
Linked list (java platform se 8 )Linked list (java platform se 8 )
Linked list (java platform se 8 )charan kumar
 
Java Amend the LinkedList so that 1 Your list classes must.pdf
Java Amend the LinkedList so that 1 Your list classes must.pdfJava Amend the LinkedList so that 1 Your list classes must.pdf
Java Amend the LinkedList so that 1 Your list classes must.pdfadinathassociates
 
Lecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxLecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxSHIVA101531
 

Similar to Please and Thank youObjective The purpose of this exercise is to .pdf (20)

Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - Java
 
Implementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdfImplementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdf
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)
 
Collection Framework-1.pptx
Collection Framework-1.pptxCollection Framework-1.pptx
Collection Framework-1.pptx
 
Array list(1)
Array list(1)Array list(1)
Array list(1)
 
Advanced core java
Advanced core javaAdvanced core java
Advanced core java
 
Built-in Data Structures in python 3.pdf
Built-in Data Structures in python 3.pdfBuilt-in Data Structures in python 3.pdf
Built-in Data Structures in python 3.pdf
 
List data structure
List data structure List data structure
List data structure
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
 
Unsorted Sorted List_Array.pptx
Unsorted Sorted List_Array.pptxUnsorted Sorted List_Array.pptx
Unsorted Sorted List_Array.pptx
 
There are a couple of new methods that you will be writing for this pr.pdf
There are a couple of new methods that you will be writing for this pr.pdfThere are a couple of new methods that you will be writing for this pr.pdf
There are a couple of new methods that you will be writing for this pr.pdf
 
Part B- Implementing a Sorted Linked list The class declarations has b.pdf
Part B- Implementing a Sorted Linked list The class declarations has b.pdfPart B- Implementing a Sorted Linked list The class declarations has b.pdf
Part B- Implementing a Sorted Linked list The class declarations has b.pdf
 
oop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionoop lecture framework,list,maps,collection
oop lecture framework,list,maps,collection
 
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
 The MyLinkedList class used in Listing 24.6 is a one-way directional .docx The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
 
Linked list (java platform se 8 )
Linked list (java platform se 8 )Linked list (java platform se 8 )
Linked list (java platform se 8 )
 
General Data structures
General Data structuresGeneral Data structures
General Data structures
 
Adt of lists
Adt of listsAdt of lists
Adt of lists
 
Collections and generics
Collections and genericsCollections and generics
Collections and generics
 
Java Amend the LinkedList so that 1 Your list classes must.pdf
Java Amend the LinkedList so that 1 Your list classes must.pdfJava Amend the LinkedList so that 1 Your list classes must.pdf
Java Amend the LinkedList so that 1 Your list classes must.pdf
 
Lecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxLecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docx
 

More from alicesilverblr

Part B Vulnerability Management Plan To prepare a vulnerability.pdf
Part B Vulnerability Management Plan To prepare a vulnerability.pdfPart B Vulnerability Management Plan To prepare a vulnerability.pdf
Part B Vulnerability Management Plan To prepare a vulnerability.pdfalicesilverblr
 
Part 1 � 10 marksAster Turane Computers uses a perpetual accountin.pdf
Part 1 � 10 marksAster Turane Computers uses a perpetual accountin.pdfPart 1 � 10 marksAster Turane Computers uses a perpetual accountin.pdf
Part 1 � 10 marksAster Turane Computers uses a perpetual accountin.pdfalicesilverblr
 
Part 1 Refer to pages 92-100 in your text as you answer these quest.pdf
Part 1 Refer to pages 92-100 in your text as you answer these quest.pdfPart 1 Refer to pages 92-100 in your text as you answer these quest.pdf
Part 1 Refer to pages 92-100 in your text as you answer these quest.pdfalicesilverblr
 
Para arz B�y�k Buhran srasnda d�t� ��nk� __________. Yant se�enekl.pdf
Para arz B�y�k Buhran srasnda d�t� ��nk� __________. Yant se�enekl.pdfPara arz B�y�k Buhran srasnda d�t� ��nk� __________. Yant se�enekl.pdf
Para arz B�y�k Buhran srasnda d�t� ��nk� __________. Yant se�enekl.pdfalicesilverblr
 
Pandas is a Python library used for working with data sets. It has f.pdf
Pandas is a Python library used for working with data sets. It has f.pdfPandas is a Python library used for working with data sets. It has f.pdf
Pandas is a Python library used for working with data sets. It has f.pdfalicesilverblr
 
page 6-7 Fraud (previously referred to as irregularities) -Inten.pdf
page 6-7 Fraud (previously referred to as irregularities) -Inten.pdfpage 6-7 Fraud (previously referred to as irregularities) -Inten.pdf
page 6-7 Fraud (previously referred to as irregularities) -Inten.pdfalicesilverblr
 
page 9 STAFF DISCUSSION OF THE RISK OF MATERIAL MISSTATEMENT DUE T.pdf
page 9 STAFF DISCUSSION OF THE RISK OF MATERIAL MISSTATEMENT DUE T.pdfpage 9 STAFF DISCUSSION OF THE RISK OF MATERIAL MISSTATEMENT DUE T.pdf
page 9 STAFF DISCUSSION OF THE RISK OF MATERIAL MISSTATEMENT DUE T.pdfalicesilverblr
 
page 8 III. OUTLINE OF STATEMENT ON AUDITING STANDARDS NO. 99, CON.pdf
page 8 III. OUTLINE OF STATEMENT ON AUDITING STANDARDS NO. 99, CON.pdfpage 8 III. OUTLINE OF STATEMENT ON AUDITING STANDARDS NO. 99, CON.pdf
page 8 III. OUTLINE OF STATEMENT ON AUDITING STANDARDS NO. 99, CON.pdfalicesilverblr
 
page 12 B. Conflicting or missing audit evidence, such as (1) Mis.pdf
page 12 B. Conflicting or missing audit evidence, such as (1) Mis.pdfpage 12 B. Conflicting or missing audit evidence, such as (1) Mis.pdf
page 12 B. Conflicting or missing audit evidence, such as (1) Mis.pdfalicesilverblr
 
page 10 (4) In-house legal counsel. E. Be aware in evaluating ma.pdf
page 10 (4) In-house legal counsel. E. Be aware in evaluating ma.pdfpage 10 (4) In-house legal counsel. E. Be aware in evaluating ma.pdf
page 10 (4) In-house legal counsel. E. Be aware in evaluating ma.pdfalicesilverblr
 
p14-15 34. The risk of fraud may be so high as to cause the audi.pdf
p14-15 34. The risk of fraud may be so high as to cause the audi.pdfp14-15 34. The risk of fraud may be so high as to cause the audi.pdf
p14-15 34. The risk of fraud may be so high as to cause the audi.pdfalicesilverblr
 
p13 29. The auditor should evaluate whether analytical procedure.pdf
p13 29. The auditor should evaluate whether analytical procedure.pdfp13 29. The auditor should evaluate whether analytical procedure.pdf
p13 29. The auditor should evaluate whether analytical procedure.pdfalicesilverblr
 
P1 Una entidad adquiere un elemento de equipo que no es de naturale.pdf
P1 Una entidad adquiere un elemento de equipo que no es de naturale.pdfP1 Una entidad adquiere un elemento de equipo que no es de naturale.pdf
P1 Una entidad adquiere un elemento de equipo que no es de naturale.pdfalicesilverblr
 
Owner, Andy Pforzheimer, holds a meeting with his employees in which.pdf
Owner, Andy Pforzheimer, holds a meeting with his employees in which.pdfOwner, Andy Pforzheimer, holds a meeting with his employees in which.pdf
Owner, Andy Pforzheimer, holds a meeting with his employees in which.pdfalicesilverblr
 
ow Effective Managers Use Information Systems Advances in computer-b.pdf
ow Effective Managers Use Information Systems Advances in computer-b.pdfow Effective Managers Use Information Systems Advances in computer-b.pdf
ow Effective Managers Use Information Systems Advances in computer-b.pdfalicesilverblr
 
Overview of the Animal Kingdom (ch. 32)a. Describe the origins and.pdf
Overview of the Animal Kingdom (ch. 32)a. Describe the origins and.pdfOverview of the Animal Kingdom (ch. 32)a. Describe the origins and.pdf
Overview of the Animal Kingdom (ch. 32)a. Describe the origins and.pdfalicesilverblr
 
Over the past ten years, if you had an innovative product like �EarP.pdf
Over the past ten years, if you had an innovative product like �EarP.pdfOver the past ten years, if you had an innovative product like �EarP.pdf
Over the past ten years, if you had an innovative product like �EarP.pdfalicesilverblr
 
OTEL RIXOS PREMIUM BELEK OTEL POZSYON PAZARLAMA EKB COVID-19d.pdf
OTEL RIXOS PREMIUM BELEK OTEL POZSYON PAZARLAMA EKB COVID-19d.pdfOTEL RIXOS PREMIUM BELEK OTEL POZSYON PAZARLAMA EKB COVID-19d.pdf
OTEL RIXOS PREMIUM BELEK OTEL POZSYON PAZARLAMA EKB COVID-19d.pdfalicesilverblr
 
other information provided is the answer for T T=-0.62 i still ne.pdf
other information provided is the answer for T T=-0.62 i still ne.pdfother information provided is the answer for T T=-0.62 i still ne.pdf
other information provided is the answer for T T=-0.62 i still ne.pdfalicesilverblr
 
Please complete the fill in the box exercise by identify the federal.pdf
Please complete the fill in the box exercise by identify the federal.pdfPlease complete the fill in the box exercise by identify the federal.pdf
Please complete the fill in the box exercise by identify the federal.pdfalicesilverblr
 

More from alicesilverblr (20)

Part B Vulnerability Management Plan To prepare a vulnerability.pdf
Part B Vulnerability Management Plan To prepare a vulnerability.pdfPart B Vulnerability Management Plan To prepare a vulnerability.pdf
Part B Vulnerability Management Plan To prepare a vulnerability.pdf
 
Part 1 � 10 marksAster Turane Computers uses a perpetual accountin.pdf
Part 1 � 10 marksAster Turane Computers uses a perpetual accountin.pdfPart 1 � 10 marksAster Turane Computers uses a perpetual accountin.pdf
Part 1 � 10 marksAster Turane Computers uses a perpetual accountin.pdf
 
Part 1 Refer to pages 92-100 in your text as you answer these quest.pdf
Part 1 Refer to pages 92-100 in your text as you answer these quest.pdfPart 1 Refer to pages 92-100 in your text as you answer these quest.pdf
Part 1 Refer to pages 92-100 in your text as you answer these quest.pdf
 
Para arz B�y�k Buhran srasnda d�t� ��nk� __________. Yant se�enekl.pdf
Para arz B�y�k Buhran srasnda d�t� ��nk� __________. Yant se�enekl.pdfPara arz B�y�k Buhran srasnda d�t� ��nk� __________. Yant se�enekl.pdf
Para arz B�y�k Buhran srasnda d�t� ��nk� __________. Yant se�enekl.pdf
 
Pandas is a Python library used for working with data sets. It has f.pdf
Pandas is a Python library used for working with data sets. It has f.pdfPandas is a Python library used for working with data sets. It has f.pdf
Pandas is a Python library used for working with data sets. It has f.pdf
 
page 6-7 Fraud (previously referred to as irregularities) -Inten.pdf
page 6-7 Fraud (previously referred to as irregularities) -Inten.pdfpage 6-7 Fraud (previously referred to as irregularities) -Inten.pdf
page 6-7 Fraud (previously referred to as irregularities) -Inten.pdf
 
page 9 STAFF DISCUSSION OF THE RISK OF MATERIAL MISSTATEMENT DUE T.pdf
page 9 STAFF DISCUSSION OF THE RISK OF MATERIAL MISSTATEMENT DUE T.pdfpage 9 STAFF DISCUSSION OF THE RISK OF MATERIAL MISSTATEMENT DUE T.pdf
page 9 STAFF DISCUSSION OF THE RISK OF MATERIAL MISSTATEMENT DUE T.pdf
 
page 8 III. OUTLINE OF STATEMENT ON AUDITING STANDARDS NO. 99, CON.pdf
page 8 III. OUTLINE OF STATEMENT ON AUDITING STANDARDS NO. 99, CON.pdfpage 8 III. OUTLINE OF STATEMENT ON AUDITING STANDARDS NO. 99, CON.pdf
page 8 III. OUTLINE OF STATEMENT ON AUDITING STANDARDS NO. 99, CON.pdf
 
page 12 B. Conflicting or missing audit evidence, such as (1) Mis.pdf
page 12 B. Conflicting or missing audit evidence, such as (1) Mis.pdfpage 12 B. Conflicting or missing audit evidence, such as (1) Mis.pdf
page 12 B. Conflicting or missing audit evidence, such as (1) Mis.pdf
 
page 10 (4) In-house legal counsel. E. Be aware in evaluating ma.pdf
page 10 (4) In-house legal counsel. E. Be aware in evaluating ma.pdfpage 10 (4) In-house legal counsel. E. Be aware in evaluating ma.pdf
page 10 (4) In-house legal counsel. E. Be aware in evaluating ma.pdf
 
p14-15 34. The risk of fraud may be so high as to cause the audi.pdf
p14-15 34. The risk of fraud may be so high as to cause the audi.pdfp14-15 34. The risk of fraud may be so high as to cause the audi.pdf
p14-15 34. The risk of fraud may be so high as to cause the audi.pdf
 
p13 29. The auditor should evaluate whether analytical procedure.pdf
p13 29. The auditor should evaluate whether analytical procedure.pdfp13 29. The auditor should evaluate whether analytical procedure.pdf
p13 29. The auditor should evaluate whether analytical procedure.pdf
 
P1 Una entidad adquiere un elemento de equipo que no es de naturale.pdf
P1 Una entidad adquiere un elemento de equipo que no es de naturale.pdfP1 Una entidad adquiere un elemento de equipo que no es de naturale.pdf
P1 Una entidad adquiere un elemento de equipo que no es de naturale.pdf
 
Owner, Andy Pforzheimer, holds a meeting with his employees in which.pdf
Owner, Andy Pforzheimer, holds a meeting with his employees in which.pdfOwner, Andy Pforzheimer, holds a meeting with his employees in which.pdf
Owner, Andy Pforzheimer, holds a meeting with his employees in which.pdf
 
ow Effective Managers Use Information Systems Advances in computer-b.pdf
ow Effective Managers Use Information Systems Advances in computer-b.pdfow Effective Managers Use Information Systems Advances in computer-b.pdf
ow Effective Managers Use Information Systems Advances in computer-b.pdf
 
Overview of the Animal Kingdom (ch. 32)a. Describe the origins and.pdf
Overview of the Animal Kingdom (ch. 32)a. Describe the origins and.pdfOverview of the Animal Kingdom (ch. 32)a. Describe the origins and.pdf
Overview of the Animal Kingdom (ch. 32)a. Describe the origins and.pdf
 
Over the past ten years, if you had an innovative product like �EarP.pdf
Over the past ten years, if you had an innovative product like �EarP.pdfOver the past ten years, if you had an innovative product like �EarP.pdf
Over the past ten years, if you had an innovative product like �EarP.pdf
 
OTEL RIXOS PREMIUM BELEK OTEL POZSYON PAZARLAMA EKB COVID-19d.pdf
OTEL RIXOS PREMIUM BELEK OTEL POZSYON PAZARLAMA EKB COVID-19d.pdfOTEL RIXOS PREMIUM BELEK OTEL POZSYON PAZARLAMA EKB COVID-19d.pdf
OTEL RIXOS PREMIUM BELEK OTEL POZSYON PAZARLAMA EKB COVID-19d.pdf
 
other information provided is the answer for T T=-0.62 i still ne.pdf
other information provided is the answer for T T=-0.62 i still ne.pdfother information provided is the answer for T T=-0.62 i still ne.pdf
other information provided is the answer for T T=-0.62 i still ne.pdf
 
Please complete the fill in the box exercise by identify the federal.pdf
Please complete the fill in the box exercise by identify the federal.pdfPlease complete the fill in the box exercise by identify the federal.pdf
Please complete the fill in the box exercise by identify the federal.pdf
 

Recently uploaded

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 

Recently uploaded (20)

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 

Please and Thank youObjective The purpose of this exercise is to .pdf

  • 1. Please and Thank you Objective: The purpose of this exercise is to create a Linked List data structure that mimics the behavior of the Java Standard Library Version (Java API). The outcomes/results of using the library features should be identical with your own version (My API). However, the underlying implementation should follow with the descriptions listed below. Instructions : Create the following Linked List Data Structure with the given description below in your utils package and use "for loops" for your repetitive tasks. Where to find starter code in my-api package.class : utils.LinkedList package.class : tests.console.week04.LinkedListTest Where to find your JUNIT test in my-api package.class : tests.junit.LinkedListJUnitTest Nested Class that has to be added to LinkedList class package.class : utils.LinkedList.Node Task Check List ONLY "for" loops should be used within the data structure class. There is an automatic 30% deduction, if other loops are used. The names of identifiers MUST match the names listed in the description below. Deductions otherwise. Complete coding Assignment in your "my-api" GitHub Repository. You will not be graded otherwise and will receive a 0, if not uploaded there. Run JUNIT TEST and take a SNAPSHOT of results. Upload PDF of snapshot of your JUnitTest results to Canvas. Description The internal structure of the Linked List is a doubly linked Node data structure and should have at a minimum the following specifications: data fields: The data fields to declare are private and you will keep track of the size of the list with the variable size and the start of the list with the reference variable data. first is a reference variable for the first Node in the list. last is a reference variable for the last Node in the list.
  • 2. size keeps track of the number of nodes in the list of type int. This will allow you to know the current size of the list without having to traversing the list. constructors: The overloaded constructors will initialize the data fields size and data. A constructor that is a default constructor initializes the starting node location first and size to a zero equivalent, that is, constructs an empty list. methods: methods that manages the behavior of the linked nodes. Together, the methods below give the illusion of a index or countable location. Implement these methods within your generic Linked List class. Method Description Header public boolean add(E item) public void add(int index, E item) public void append( E item) private void checkIndex(int index) public boolean contains(E item) public void clear() private E detach(int index) public E get(int index) public int indexOf(E item) private void insertBefore(int index, E item) public boolean isEmpty() private Node node(int index) public E remove(int index) public boolean remove(E item) public E set(int index, E item) public int size() public String toString() Node Data Structure The generic Linked List class includes a static Node class as a nested class, i.e. a static inner class within the Linked List class. inner class: class inside the body of another class. Note: This private class does not require access to instance members of the outer class, so it is declared static. This means that the node object wont be coupled to the outer class object, thus
  • 3. will be more optimal since it wont require heap/stack memory. data fields: data : hold the data stored in each node as is of type E. next : stores the location of the next node in the list. prev : stores the location of the previous node in the list. constructor: A constructor that receives parameters for data, and prev and calls the second constructor. public Node(Node prev, E data) A constructor that receives parameters for data, next and prev. public Node(Node prev, E data, Node next) Method Description Header add(item)uses the append method and ensures that there is enough spaces to store each element in the list. Also updates the number of elements in the list by one. This method returns true, if the data was added successfully. public boolean add(E item) add(index, item)inserts elements at a given location in the list, shifting subsequent elements to the right. Uses the append and insertBefore methods to assist with adding items to the front, back and middle of the list. Updates the number of elements in the list by one. public void add(int index, E item) append(item)appends elements to the end of the list, but does not update the number of elements. This is a private helper method. public void append( E item) checkIndex(index)checks if the given index is valid. Validation means that you cannot access indexes where elements have not been placed. Throws an IndexOutOfBoundsException, if invalid. This is a private helper method. private void checkIndex(int index) contains(item)searches for a specific item within the linked structure and returns true, if the item is in the list. public boolean contains(E item) clear()clears list of all elements, returns size back to zero. public void clear() detach(index)detaches the node at the specified index from list and returns the deleted element, but does not reduce the size of the list. This is a private helper method. private E detach(int index) get(index)returns the item at the specified position in the list. This method first checks if the index requested is valid. public E get(int index) indexOf(item)searches for a specific item within the linked structure and returns the first occurrence (i.e. index location) in the list, otherwise returns -1, if NOT found. public int indexOf(E item) insertBefore(index, item)inserts an item before the non-null node at the specified index in the list. Traverses the list to find this node. This method also checks for insertions at the start and end of the list, as well as when empty. This is a private helper method.
  • 4. private void insertBefore(int index, E item) isEmpty()returns true, if the list is empty, i.e., the list contains no elements. public boolean isEmpty() node(index)returns a reference to the node at the given position in the list. This node traverses the list in two directions from front to middle and back to middle. This is a private helper method. private Node node(int index) remove(index)removes the item at the given position in the list for a valid index. Checks for valid index before it proceeds with removal. Shifts subsequent elements to the left and returns the item removed. The number of elements in the list is reduced by one. public E remove(int index) remove(item)removes the first occurrence of the specified item from the list, if present. Shifts subsequent elements to the left and returns true, if the item is removed. The number of elements in the list is reduced by one. public boolean remove(E item) set(index, item)replaces the item at the specified position with the one passed. This method checks if the index requested is valid before it does the replacement and returns the replaced item. public E set(int index, E item)size()returns the number of elements in the list. public int size()toString()displays the contents of the list according to the same format at shown in the Java API. public String toString()