Write a method called isSorted that returns true if the list is in sorted (nondecreasing) order and returns false otherwise. An empty list is considered to be sorted.
Add the above method to the LinkedIntList class from this chapter.
Implementation of isSorted method:
public boolean isSorted()
{
if(front == null)
return true;
ListNode current = front;
while(current.next != null)
{
if(current.data > current.next.data)
return false;
current = current.next;
}
return true;
}