Objective: The purpose of this lab exercise is to create a Singly Linked List data structure . Please note that the unde
Posted: Fri May 20, 2022 5:48 pm
Objective: The purpose of this lab
exercise is to create a Singly Linked List data structure . Please
note that the underlying implementation should follow with the
descriptions listed below.
Instructions : Create the following Linked
List Data Structure in your "utils"
package and ONLY use "for
loops" for your repetitive tasks. Use the internal
generic node class specified below to implement the underlying
linked data structures.
Where to place your code in my-api
package.class : utils.SinglyLinkedList
Where to place your test code in my-api
package.class : tests.console.week01.SLLPrintTest
Where to find the JUnit Test code in my-api
package.class : tests.junit.SLLJUnitTest
Task Check List
Description
The internal structure of this Linked List is
a singly 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.
constructors: initializes the data fields size
and data.
outer class methods: manages the behavior of
the linked nodes. Together, these methods below give the
illusion of an index or countable location.
Method
Description
Header
public boolean add(T item)
public void add(int index, T item)
public void append(T item)
private void checkIndex(int index)
private T detach(int index)
public T get(int index)
private void insertBefore(int index, T item)
public boolean isEmpty()
private Node node(int index)
public T remove(int index)
public T set(int index, T item)
public int size()
public String toString()
Node<E> Data Structure
The generic Linked List class includes a static Node class as a
nested class, i.e. a static innerclass 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 won’t be coupled to the outer class
object, thus will be more optimal since it won’t require additional
heap/stack memory.
data fields:
constructor:
A constructor that receives parameters for data, and prev and
calls the second constructor.
public
Node(E data)
A constructor that receives parameters for data, and
next.
public
Node(E data, Node<E> next)
PLEASE UPLOAD THE FULL CODE AND ITS OUTPUT WITH
SCREENSHOTS!!!
exercise is to create a Singly Linked List data structure . Please
note that the underlying implementation should follow with the
descriptions listed below.
Instructions : Create the following Linked
List Data Structure in your "utils"
package and ONLY use "for
loops" for your repetitive tasks. Use the internal
generic node class specified below to implement the underlying
linked data structures.
Where to place your code in my-api
package.class : utils.SinglyLinkedList
Where to place your test code in my-api
package.class : tests.console.week01.SLLPrintTest
Where to find the JUnit Test code in my-api
package.class : tests.junit.SLLJUnitTest
Task Check List
Description
The internal structure of this Linked List is
a singly 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.
constructors: initializes the data fields size
and data.
outer class methods: manages the behavior of
the linked nodes. Together, these methods below give the
illusion of an index or countable location.
Method
Description
Header
public boolean add(T item)
public void add(int index, T item)
public void append(T item)
private void checkIndex(int index)
private T detach(int index)
public T get(int index)
private void insertBefore(int index, T item)
public boolean isEmpty()
private Node node(int index)
public T remove(int index)
public T set(int index, T item)
public int size()
public String toString()
Node<E> Data Structure
The generic Linked List class includes a static Node class as a
nested class, i.e. a static innerclass 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 won’t be coupled to the outer class
object, thus will be more optimal since it won’t require additional
heap/stack memory.
data fields:
constructor:
A constructor that receives parameters for data, and prev and
calls the second constructor.
public
Node(E data)
A constructor that receives parameters for data, and
next.
public
Node(E data, Node<E> next)
PLEASE UPLOAD THE FULL CODE AND ITS OUTPUT WITH
SCREENSHOTS!!!