{"id":1074,"date":"2013-04-23T05:49:34","date_gmt":"2013-04-22T19:49:34","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=1074"},"modified":"2019-10-04T17:43:43","modified_gmt":"2019-10-04T07:43:43","slug":"java-linkedlist-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/java-linkedlist-primer-tutorial\/","title":{"rendered":"Java LinkedList Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/JavaLinkedList\/\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Java LinkedList Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Java\/JavaLinkedList\/Java_LinkedList_Primer.jpg\" title=\"Java LinkedList Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Java LinkedList Primer Tutorial<\/p><\/div>\n<p>Here is a tutorial that uses LinkedList structure in Java on a Mac laptop.<\/p>\n<blockquote><p>In computer science, a linked list is a data structure consisting of a group of nodes which together represent a sequence. Under the simplest form, each node is composed of a datum and a reference (in other words, a link) to the next node in the sequence; more complex variants add additional links. This structure allows for efficient insertion or removal of elements from any position in the sequence.<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"408\" height=\"41\" src=\"\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/6\/6d\/Singly-linked-list.svg\/408px-Singly-linked-list.svg.png\" alt=\"File:Singly-linked-list.svg\"><br \/><small><i>A linked list whose nodes contain two fields: an integer value and a link to the next node. The last node is linked to a terminator used to signify the end of the list.<\/i><\/small><br \/>\nA linked list whose nodes contain two fields: an integer value and a link to the next node. The last node is linked to a terminator used to signify the end of the list.<\/p>\n<p>Linked lists are among the simplest and most common data structures. They can be used to implement several other common abstract data types, including stacks, queues, associative arrays, and S-expressions, though it is not uncommon to implement the other data structures directly without using a list as the basis of implementation.<\/p>\n<p>The principal benefit of a linked list over a conventional array is that the list elements can easily be inserted or removed without reallocation or reorganization of the entire structure because the data items need not be stored contiguously in memory or on disk. Linked lists allow insertion and removal of nodes at any point in the list, and can do so with a constant number of operations if the link previous to the link being added or removed is maintained during list traversal.<\/p>\n<p>On the other hand, simple linked lists by themselves do not allow random access to the data, or any form of efficient indexing. Thus, many basic operations \u2014 such as obtaining the last node of the list (assuming that the last node is not maintained as separate node reference in the list structure), or finding a node that contains a given datum, or locating the place where a new node should be inserted \u2014 may require scanning most or all of the list elements.<\/p><\/blockquote>\n<p>\nThis tutorial&#8217;s code is modified from the <em>Java Examples in a Nutshell (O&#8217;Reilly)<\/em> as downloadable, in original form (our tutorial is modified a little), from <a target=_blank title='Not for commercial purposes' href='http:\/\/examples.oreilly.com\/9781565923713\/'>here<\/a> &#8230; not for commercial purposes as per code&#8217;s top comments.<\/p>\n<p>Let&#8217;s see some  <a target=_blank title='click picture' href='http:\/\/www.rjmprogramming.com.au\/Java\/JavaLinkedList\/'>Java<\/a> code for this, and how it works &#8230;\n<\/p>\n<p>Link to Linked List more information &#8230; <a target=_blank href='http:\/\/en.wikipedia.org\/wiki\/Linked_list' title='Link to Linked List more information'>via Wikipedia, from where quote above came<\/a>.<br \/>\n<a target=_blank href='http:\/\/www.rjmprogramming.com.au\/Java\/JavaLinkedList\/LinkedList.java-GETME'>Download programming source code and rename to LinkedList.java<\/a><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d1074' onclick='var dv=document.getElementById(\"d1074\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?s=Java\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d1074' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Here is a tutorial that uses LinkedList structure in Java on a Mac laptop. In computer science, a linked list is a data structure consisting of a group of nodes which together represent a sequence. Under the simplest form, each &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/java-linkedlist-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[644,703,997,1319],"class_list":["post-1074","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-java","tag-linked-list","tag-programming","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/1074"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=1074"}],"version-history":[{"count":1,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/1074\/revisions"}],"predecessor-version":[{"id":46654,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/1074\/revisions\/46654"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=1074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=1074"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=1074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}