Can someone help me understand what the following code does and what the line with two equal sign does? How does something equal to something equal to something work in this constructor?
public More ...LinkedList() {
header.next = header.previous = header;
}
Here is the link to the website where I saw this and I'm trying to figure it out: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/LinkedList.java#LinkedList.0header
Read assignment statement from right to left:
header
to header.pevious
header.previous
to header.next
The bottom line: after this line both header.previous
header.next
will refer to header
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With