Jun
4
Arrays demystified - on the way to a treasure hunt.

Rewrote some of @wandernauta’s code to use arrays of arrays. Until we get proper docs on everything (ha!), I thought taking this as an example couldn’t hurt.
Just to be clear: objects are references in ooc, so when I declare Tile[][], it holds pointers to tiles, hence 1) they need to be initialized properly, 2) they only take 4/8 bytes in the array depending on your platform.
Also, do not confuse arrays with ArrayLists. Arrays are built-in, not resizable, and faster. ArrayLists are proper generic classes, resizable. Both are bound-checked (e.g. crash loudly when you access/write them outside their bounds instead of silently corrupting your memory).