Just for the sake of demonstration, imagine int
is not a primitive type. Then an array holding the values itself would be like this
Address 0xaddr0 0xaddr1 0xaddr2
+--------+--------+--------+
Content | 69 | 420 | 1337 |
+--------+--------+--------+
And lists holding addresses (references) would be like this
Address 0xaddr0 0xaddr1 0xaddr2 0xaddr3 0xaddr4 0xaddr5
+---------+---------+---------+
Content | 0xaddr3 | 0xaddr4 | 0xaddr5 | 69 420 1337
+---------+---------+---------+ ^ ^ ^
| | | | | |
+---------+---------+---------+ | |
| | | |
+---------+--------------------+ |
| |
+-----------------------------+
So when you're getting a value from an array, you get it immediately; but for lists, you get the address of that value, then go to that address to actually get the value.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…