Write a method called set that accepts an index and a value and sets the list’s element at that index to have the given value. You may assume that the index is between 0 (inclusive) and the size of the list (exclusive).
Add the above method to the LinkedIntList class from this chapter.
Implementation of set method:
public void set(int index, int value)
{
if(front == null || index < 0 || index >= size())
return;
ListNode current = front;
for(int i = 0; i < index; i++)
{
current = current.next;
}
current.data = value;
}