linked list

linked list next specific question

Page 1 of 1

2 Replies - 2410 Views - Last Post: 13 February 2008 - 07:29 AM Rate Topic: -----

#1 zoemayne  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 26-September 07

linked list

Post icon  Posted 06 February 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 "[]"

Is This A Good Question/Topic? 0
  • +

Replies To: linked list

#2 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5780
  • View blog
  • Posts: 12,595
  • Joined: 16-October 07

Re: linked list

Posted 07 February 2008 - 06:32 AM

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.
Was This Post Helpful? 0
  • +
  • -

#3 Guest_dato.java*


Reputation:

Re: linked list

Posted 13 February 2008 - 07:29 AM

View Postzoemayne, on 6 Feb, 2008 - 10:20 PM, said:

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.
Was This Post Helpful? 0

Page 1 of 1