I’m working on implementing an algorithm from a paper. The paper describes using a grid, where each grid square holds a linked list of integers that represent objects in that grid square.
I decided to implement this using LinkedList<Integer>[][], which of course gives me a generic array creation error.
I can’t think of a better way of representing the idea of a grid of linked lists. I also understand that using LinkedList[][] would compile but is bad practice as it is untyped. However, I would prefer not to use ArrayList<ArrayList<LinkedList<Integer>>> because that is unreadable, at least to me.
Is there a way around using an untyped LinkedList here? Or perhaps some other solution?
The list version
is not unreadable. To access a grid square it’s just
Not that tough on the brane.