public void addAtEnd(int item) {
Node nn = new Node(item);
//Attach new node to the previous node
if(this.size >= 1)
this.tail.next = nn;
//Shift tail at the end node
else head = nn;
tail = nn;
size++;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter