LList - Node current = head; //initization step int counter...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class LList{ Node head; //firstNode //default constructor public LList(){ head = null; } public LList(Node head){ this.head = head; } //getters public Node getHead(){ return head; } //setters public void setHead(Node head){ this.head = head; } public void add(Node node){ Node current = head; //initization step while(current.getNext() != null){ //conditional step current = current.getNext(); //incremental step } current.setNext(node); } public int size(){
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Node current = head; //initization step int counter = 0; while(current != null){ //conditional step counter++; current = current.getNext(); //incremental step } return counter; } public String toString(){ String ret = ""; Node current = head; //initization step while(current != null){ //conditional step ret = ret + current.toString(); current = current.getNext(); //incremental step } return ret; } }...
View Full Document

This note was uploaded on 01/30/2010 for the course CS 1316 taught by Professor Staff during the Spring '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online