Difference between revisions of "CSC212 Lab 6 Solutions 2014"
Line 39: | Line 39: | ||
addToHead( el ); | addToHead( el ); | ||
else { | else { | ||
− | tail.next = new | + | tail.next = new IntSLLNode( el ); |
tail = tail.next; | tail = tail.next; | ||
− | + | } | |
− | + | length++; | |
} | } | ||
Line 65: | Line 65: | ||
System.out.println( "+===========================================\n| List:"); | System.out.println( "+===========================================\n| List:"); | ||
System.out.println( isEmpty()? "| is empty": "| is not empty" ); | System.out.println( isEmpty()? "| is empty": "| is not empty" ); | ||
− | System.out.println( "| contains " + length + " | + | System.out.println( "| contains " + length + " elements" ); |
System.out.print( "| elements: " ); | System.out.print( "| elements: " ); | ||
printAll(); | printAll(); | ||
System.out.println( "+===========================================" ); | System.out.println( "+===========================================" ); | ||
} | } | ||
− | |||
public static void main(String[] args) { | public static void main(String[] args) { |