Write a method called min that returns the minimum value in a list of integers. If the list is empty, it should throw a NoSuchElementException.
Add the above method to the LinkedIntList class from this chapter.
Implementation of min method:
public int min()
{
if(front == null)
throw new NoSuchElementException();
int minimum = front.data;
ListNode current = front.next;
while(current != null)
{
if(current.data < minimum)
{
minimum = current.data;
}
current = current.next;
}
return minimum;
}