what does it mean?
does it mean the previous of the current and then the next of the previous of the previous current which is the current itself.............i know thats wrong soooo how do i not confuse it again"???
Actually, you explained it correctly. If "current", "previous", and "next" are all links to nodes in a linked list, and each node has members named "previous" and "next", and "current" points to some node of interest that is not the very first node in the list, then "current.previous.next" would be the node after the node before the current node -- or the current node itself. Similarly, if "first" points to some node which is not the last node in the list, then "first.next.previous" would be the node before the node after first -- i.e., first.
the dot operators go left to right. so, the first one is saying
take the current object, get its previous reference, and then take THAT things next reference.
Assuming current points to the nth object, current.previous would give you the (n-1)th object. You then get the next reference from the (n-1)th, which should give you the nth.
your second example is similar. first should point to the 1st object. you then get the reference to the next object, which would give you the 2nd. you then get the previous reference from the 2nd, putting you back at the 1st.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Dec 10, 2008
Ernest Friedmann Hill : thank you soo much ,, you made it really simple for me to understand it!! its an honor to have you here to help us in our problems!!