linkedLists
Class IntList

java.lang.Object
  extended by linkedLists.IntList

public class IntList
extends java.lang.Object


Constructor Summary
IntList()
          Default constructor that creates an empty list
IntList(IntNode n)
          constructor to create a list with head node n
 
Method Summary
 void addFirst(IntNode n)
          add a new node at front of list
 void addValue(java.lang.Integer i)
          add node to front of list containing a given value
 void addValueInOrder(java.lang.Integer i)
          Add new value in non-decreasing order into list
 IntNode delete(int v)
          delete all nodes containing the value v from list and return the head of the list
 IntNode delete0()
          delete the first node containing 0 from list and return the head of the list
 IntNode getHead()
          return the head of the list
 boolean inList(int i)
          is Node containing i in list?
 boolean isEmpty()
          is the list empty?
 void removeFirst()
          remove node from front of list
 void removeValue(int i)
          remove all nodes containing element with a given value
 void setHead(IntNode n)
          set the head of the list
 int size()
          return size of list
 int sum()
          returns the sum of the elements list, recursive
 java.lang.String toString()
          String representation of list, recursive
 void writePos()
          output positive elements of list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntList

public IntList()
Default constructor that creates an empty list


IntList

public IntList(IntNode n)
constructor to create a list with head node n

Method Detail

getHead

public IntNode getHead()
return the head of the list


setHead

public void setHead(IntNode n)
set the head of the list


isEmpty

public boolean isEmpty()
is the list empty?


addFirst

public void addFirst(IntNode n)
add a new node at front of list


removeFirst

public void removeFirst()
remove node from front of list


addValue

public void addValue(java.lang.Integer i)
add node to front of list containing a given value


inList

public boolean inList(int i)
is Node containing i in list?


addValueInOrder

public void addValueInOrder(java.lang.Integer i)
Add new value in non-decreasing order into list


removeValue

public void removeValue(int i)
remove all nodes containing element with a given value


writePos

public void writePos()
output positive elements of list


delete0

public IntNode delete0()
delete the first node containing 0 from list and return the head of the list


delete

public IntNode delete(int v)
delete all nodes containing the value v from list and return the head of the list


size

public int size()
return size of list


sum

public int sum()
returns the sum of the elements list, recursive


toString

public java.lang.String toString()
String representation of list, recursive

Overrides:
toString in class java.lang.Object