Difference between revisions of "CSC212 Lab 6 Solutions 2014"
Line 41: | Line 41: | ||
tail.next = new IntSLLNode( el ); | tail.next = new IntSLLNode( el ); | ||
tail = tail.next; | tail = tail.next; | ||
+ | length++; | ||
} | } | ||
− | + | ||
} | } | ||
Line 65: | Line 66: | ||
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 + " element" + ((length!=1)? "s":"" ) ); |
System.out.print( "| elements: " ); | System.out.print( "| elements: " ); | ||
printAll(); | printAll(); |