Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a Java Expert!

Join 244,291 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 946 people online right now. Registration is fast and FREE... Join Now!




linked list

 
Reply to this topicStart new topic

linked list, linked list next specific question

zoemayne
6 Feb, 2008 - 09:20 PM
Post #1

New D.I.C Head
*

Joined: 26 Sep, 2007
Posts: 3


My Contributions
i have been searching and searching about java linked list and I cant find information i need on "next"( many sample programs use the word "next"). I don't understand how it is being manipulated- I understand how linked list work ie the pointing etc. in some coding i see something like current = current.next; how could this be correct because next is not a method it does not have the parenthesis....and is not in the api etc. i understand how linked list work i just dont understand what is the deal with current.next......next = null........ if some one can explain this to me please do so lets assume next is equal to int[] next; and Anytype next; I know that "int[] next;" is an arraylist but I can't find any info on using "[]"

User is offlineProfile CardPM
+Quote Post


baavgai
RE: Linked List
7 Feb, 2008 - 05:32 AM
Post #2

Dreaming Coder
Group Icon

Joined: 16 Oct, 2007
Posts: 3,572



Thanked: 268 times
Dream Kudos: 525
Expert In: C, C++, Java, C#, ASP.NET, PHP, Perl, Python, Oracle, SQL Server, MySql, HTML, JavaScript, Lua, Cheese

My Contributions
In C and C++, next is a pointer to the next node. In Java, the next node is just another object instance.

Try google. It's out there. Use "node" in the search.

Hope this helps.

User is offlineProfile CardPM
+Quote Post

dato.java
RE: Linked List
13 Feb, 2008 - 06:29 AM
Post #3

New D.I.C Head
*

Joined: 13 Feb, 2008
Posts: 33

QUOTE(zoemayne @ 6 Feb, 2008 - 10:20 PM) *

i have been searching and searching about java linked list and I cant find information i need on "next"( many sample programs use the word "next"). I don't understand how it is being manipulated- I understand how linked list work ie the pointing etc. in some coding i see something like current = current.next; how could this be correct because next is not a method it does not have the parenthesis....and is not in the api etc. i understand how linked list work i just dont understand what is the deal with current.next......next = null........ if some one can explain this to me please do so lets assume next is equal to int[] next; and Anytype next; I know that "int[] next;" is an arraylist but I can't find any info on using "[]"


for exam: List list=new LinkedList();
Iterator iter=list.iterator();
list.add(4);
list.add(5);
while(iter.hasnext())
System.out.println(iter.next());
it is a next node of any lists and containers(array is exception)
when while begins it'll check if there is next object in that list and returns true if there is,or returns false if there is not. if iter.hasnext() return true after that iter.next() it is first Object of that list and it goes on while there are elements in lists.

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 03:53PM

Live Java Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month